0

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?

Wayne
  • 59,728
  • 15
  • 131
  • 126
Nick Allen
  • 11,970
  • 11
  • 45
  • 58

1 Answers1

2

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/

Torbjörn Gyllebring
  • 17,928
  • 2
  • 29
  • 22