codemonkey2480
asked on
XMLDocument not able to locate a node - SelectSingleNode
I have simple XML file. I need to read the value of the element <totalresults>.
Please see code below, it never seems to locate that node. What is wrong with this?
Please help.
Please see code below, it never seems to locate that node. What is wrong with this?
Please help.
XML
<?xml version="1.0" encoding="utf-8"?>
<feed>
<totalresults>0</totalresults>
<startindex>1</startindex>
<itemsperpage>25</itemsperpage>
<entry/>
</feed>
C# Code
xmldoc.Load("C:/test.xml");
XmlNode node=xmldoc.SelectSingleNode("//totalresults");
if (node != null)
return node.InnerText;
else
return "0";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.