Sep-17-2020, 03:33 PM
For some reason, it finds 'Placemark', but not 'LineString', altough both are nested dictionaries:
print(key_exists2(doc, 'Placemark')) #True print(key_exists2(doc, 'LineString')) #Falseinput.kml:
<?xml version="1.0" encoding="utf-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <name>Document.kml</name> <open>1</open> <Style id="exampleStyleDocument"> <LabelStyle> <color>ff0000cc</color> </LabelStyle> </Style> <Placemark> <name>Document Feature 1</name> <styleUrl>#exampleStyleDocument</styleUrl> <Point> <coordinates>-122.371,37.816,0</coordinates> </Point> </Placemark> <Placemark> <name>Document Feature 2</name> <styleUrl>#exampleStyleDocument</styleUrl> <Point> <coordinates>-122.370,37.817,0</coordinates> </Point> </Placemark> <Placemark> <name>My track</name> <LineString> <coordinates>-0.376291,43.296237,199.75 -0.377381,43.29405</coordinates> </LineString> </Placemark> </Document> </kml>