Reputation: 2463
I have below xml string
<Folder>
<name></name>
<Placemark>
<name></name>
<description></description>
<styleUrl></styleUrl>
<MultiGeometry>
<Point>
<coordinates></coordinates>
</Point>
<LineString>
<coordinates></coordinates>
<tesselate>1</tesselate>
</LineString>
</MultiGeometry>
</Placemark>
</Folder>
Using XElement, is there any way to pull Point element from the xml string without having to traverse through it's parent node? (MultiGeometry)
Upvotes: 1
Views: 10801
Reputation: 693
If the data is loaded into a valid XElement you can use Descendants
e.g.
var xElement = XElement.Load(path);
var points = xElement.Descendants("Point");
var point = points.FirstOrDefault();
Upvotes: 10