ETL Pentaho 中的 loopXPath 从 XML 获取数据

loopXPath in ETL Pentaho get data from XML

我正在尝试为 kml 文件找到正确的循环 XPath,但我找不到可以正常工作的路径。我的 kml 文件是这样的:

<?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>...

我想提取所有 SimpleData 节点(osm_id、ref、..),尤其是文件中每个地标的坐标。

您可以使用:

//*[local-name()='Folder']/*/*/*/*[local-name()='SimpleData'][@name='osm_id']/text() 用于获取 osm_id 例如。

对于坐标: //*[local-name()='Folder']/*/*/*[local-name()='coordinates']/text()