Hi all, I need to extract coordinates from an XML file (specifically a KML file). I used IEnumerable to search for all tags with "coordinates" but nothing at all prints out in the "foreach" loop. Can someone guide me what is incorrect here? Here is a test kml file to help: hastebin.
C#:
XDocument kmlDoc = XDocument.Load("Documents\\c#\\SafeFlyZone.kml");
IEnumerable<XElement> coordinates = kmlDoc.Elements("coordinates") ;
foreach (XElement c in coordinates)
{
Console.WriteLine(c);
Console.WriteLine("hi");
}
Last edited by a moderator: