I'm trying to find the correct loop XPath for a kml file, but i can't find a path that works properly. My kml file is like:
<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="root_doc">
<Schema name="ProvaIsole" id="ProvaIsole">
<SimpleField name="osm_id" type="string"></SimpleField>
<SimpleField name="ref" type="string"></SimpleField>
<SimpleField name="type" type="string"></SimpleField>
<SimpleField name="oneway" type="int"></SimpleField>
<SimpleField name="bridge" type="int"></SimpleField>
<SimpleField name="tunnel" type="int"></SimpleField>
<SimpleField name="maxspeed" type="int"></SimpleField>
</Schema>
<Folder><name>ProvaIsole</name>
<Placemark>
<name>Via del Mare</name>
<Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
<ExtendedData><SchemaData schemaUrl="#ProvaIsole">
<SimpleData name="osm_id">2441818</SimpleData>
<SimpleData name="ref">SS129</SimpleData>
<SimpleData name="type">primary</SimpleData>
<SimpleData name="oneway">0</SimpleData>
<SimpleData name="bridge">0</SimpleData>
<SimpleData name="tunnel">0</SimpleData>
</SchemaData></ExtendedData>
<LineString><altitudeMode>clampToGround</altitudeMode><coordinates>9.6980313,40.3786877</coordinates></LineString>
</Placemark>...
and I want to extract all the SimpleData node (osm_id, ref, ..) and, in particular, the coordinates for each Placemark in the file.
You can use :
//*[local-name()='Folder']/*/*/*/*[local-name()='SimpleData'][@name='osm_id']/text()
for getting osm_id for example.
For coordinates:
//*[local-name()='Folder']/*/*/*[local-name()='coordinates']/text()