Question

I am returning XML data from the Yahoo GeoPlanet web service using HttpWebRequest.

I am loading the XML using

XPathDocument doc = new XPathDocument(HttpWebResponse.GetResponseStream())

Next comes:

XPathNavigator nav = doc.CreateNavigator();

If I do nav.Select("places"); or nav.Select("/places"); or nav.Select("//places");, nothing gets returned!

But if I do nav.select("/*");, I get the node and doing node.Name returns places?

Was it helpful?

Solution

I know nothing about the format of the Yahoo data but I do know that the most common misstake with C# and XPath is forgetting to add the relevant namespaces to your "NamespaceManager" have a look here http://mydotnet.wordpress.com/2008/05/29/worlds-smallest-xml-xpath-tutorial/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top