Hi
I had a quick question - How do I use Xpath to search the following xml file? Or should I be using something else? Pls note that the file has xml empty tags.
xml file
I tried the following code in C# ASP.net
and it showed the following error
Expression must evaluate to a node-set.The error occured at the last line(5)
I would like the node list to have 'Denmark'. I highly appreciate any kind of suggestion.
Thanks
Kim
--------------------------------------------------------------------------------
I had a quick question - How do I use Xpath to search the following xml file? Or should I be using something else? Pls note that the file has xml empty tags.
xml file
Code:
<World> <Country Name ="Denmark"/> <Country Name ="Hungry"/> </World>
Code:
XmlDocument doc = new XmlDocument(); doc.Load("C:\\world.xml"); XmlNodeList nodeList; XmlNode root = doc.DocumentElement; nodeList = root.SelectNodes("World/[Country Name='Denmark']");
Expression must evaluate to a node-set.The error occured at the last line(5)
I would like the node list to have 'Denmark'. I highly appreciate any kind of suggestion.
Thanks
Kim
--------------------------------------------------------------------------------
Comment