I have xml document like this:
<?xml version="1.0" encoding="utf-8"?>
<ymaps xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<GeoObjectCollection>
<metaDataProperty xmlns="http://www.opengis.net/gml">
...
</metaDataProperty>
<featureMember xmlns="http://www.opengis.net/gml">
<GeoObject>
...
<Point xmlns="http://www.opengis.net/gml">
<pos>0.000 0.000</pos>
</Point>
</GeoObject>
</featureMember>
</GeoObjectCollection>
How to get pos
node?
I try to get node like this:
var ss = xmlDoc.DocumentElement.SelectNodes("/ymaps/GeoObjectCollection");
But i get empty list.
So, i can get pos
node with recurcive method:
private string GetGeoPosition(XmlNode node)
{
if (node.Name != "GeoObjectCollection")
{
var nodes = node.ChildNodes;
foreach (XmlNode nod in nodes)
{
GetGeoPosition(nod);
}
}
...
return "";
}
But it seems not right way to do it.
Can i use SelectNodes
method to do that? Or i shoud go recurcive?