I am working with the google maps results.
A shortened example xml:
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8" ?>
- <kml xmlns="http://earth.google.com/kml/2.0">
- <Document>
- <Placemark>
- <name>Route</name>
- <description>
- <![CDATA[ Distance: 2,164 mi (about 1 day 7 hours)<br/>Map data ©2009 Sanborn, Tele Atlas ]]>
- </description>
- </Placemark>
- </Document>
- </kml>
After populating an XmlDocument doc, I tried to use this:
doc.SelectSingleNode("/kml/Document/placemark[name='route']/description");
and
doc.SelectNodes("/kml/Document/placemark[name='route']/description");
They always turn up no results.
I even tried:
doc.SelectNodes("//description");
which also produced no results.
I was able to get it by using a non-xpath expression:
doc.ChildNodes[1].ChildNodes[0].LastChild["description"];
But seems very unstable as it relies on those indexes existing.
Does anyone know what is wrong with the XPath I used? Is it a namespace issue (I set up no namespaces)?