I am trying to extract values of : url,ttype,tempTnxId,token,txnStage
from the following XML string:
<?xml version="1.0" encoding="UTF-8"?>
<MMP>
<MERCHANT>
<RESPONSE>
<url>https://payment.xyz.com/paynetz/epi/fts</url>
<param name="ttype">abc</param>
<param name="tempTxnId">12319507</param>
<param name="token">x5H9RrhgfXvamaqEl6GpY4uCoXHN%2FlEm%2BUpaaKuMQus%3D</param>
<param name="txnStage">1</param>
</RESPONSE>
</MERCHANT>
</MMP>
So far I have only been able to extract values with index using following code:
foreach (XmlNode node in doc.SelectNodes("/MMP/MERCHANT/RESPONSE/param"))
{
string tempTxnId= doc.SelectNodes("/MMP/MERCHANT/RESPONSE/param")[1].InnerText;//only works with index and not name
}
/MMP/MERCHANT/RESPONSE/param
or /MMP/MERCHANT/RESPONSE/ttype
does not return anything.
This solution :Getting specified Node values from XML document does not seem to be working for me.
XmlDocument doc = new XmlDocument();
doc.LoadXml(xmlstring);
var result = doc.Elements("table"); ///cant find Elements, Element is is not identified by the compiler