我的 xml 文档看起来像..(它实际上是一个用于谷歌地图的 kml 文件..)
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<Name>Folder1</Name>
<Placemark>
<Name>Placemark1Folder1</Name>
<LookAt>
<longitude>-122.0839597145766</longitude>
<latitude>37.42222904525232</latitude>
</LookAt>
</Placemark>
<Placemark>
<Name>Placemark2Folder1</Name>
<LookAt>
<longitude>-101.083959</longitude>
<latitude>26.422</latitude>
</LookAt>
</Placemark>
</Folder>
<Folder>
<Name>Folder2</Name>
<Placemark>
<Name>Placemark1Folder2</Name>
<LookAt>
<longitude>-96.566556</longitude>
<latitude>14.422</latitude>
</LookAt>
</Placemark>
</Folder>
</Document>
</kml>
根据每个文件夹节点的每个地标,我想制作一个单独的 xml 文件,例如
第一个 XML:
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<Name>Folder1</Name>
<Placemark>
<Name>Placemark1Folder1</Name>
<LookAt>
<longitude>-122.0839597145766</longitude>
<latitude>37.42222904525232</latitude>
</LookAt>
</Placemark>
</Folder>
</Document>
</kml>
第二个xml
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<Name>Folder1</Name>
<Placemark>
<Name>Placemark2Folder1</Name>
<LookAt>
<longitude>-101.083959</longitude>
<latitude>26.422</latitude>
</LookAt>
</Placemark>
</Folder>
</Document>
</kml>
第三个xml
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<Name>Folder2</Name>
<Placemark>
<Name>Placemark1Folder2</Name>
<LookAt>
<longitude>-96.566556</longitude>
<latitude>14.422</latitude>
</LookAt>
</Placemark>
</Folder>
</Document>
</kml>
..我是 xml 的初学者 ..请帮忙