I have tried lots of solutions from here but never succeed. I have been trying to find out a specific value from a XML document but I am getting null value everytime. I think I am mixing up with NameSpaces. Please help.
My XML Document:
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:m0="http://schemas.compassplus.com/two/1.0/fimi_types.xsd"
xmlns:m1="http://schemas.compassplus.com/two/1.0/fimi.xsd">
<env:Body>
<m1:InitSessionRp >
<m1:Response NextChallenge="48469495" Response="1" Ver="16.1" Product="FIMI">
<m0:Id>889060</m0:Id>
<m0:NeedCAPAuth>0</m0:NeedCAPAuth>
</m1:Response>
</m1:InitSessionRp>
</env:Body>
</env:Envelope>
I tried:
var ns = new XmlNamespaceManager(xmlRespDoc.NameTable);
ns.AddNamespace("m1", "http://schemas.compassplus.com/two/1.0/fimi.xsd");
var sessionId = xmlRespDoc.SelectSingleNode("/m1:InitSessionRp/m1:Response/m1:Id", ns)?.InnerText;
var nextChallengeId = xmlRespDoc.SelectSingleNode("/m1:InitSessionRp/m1:Response/m1:NextChallenge", ns)?.InnerText;
Please Help!