我有以下 xml 格式,它实际上是谷歌地图的 kml 文件。
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Name>TestDoc</Name>
<Style id="Style1">
<PolyStyle>
<fill>0</fill>
</PolyStyle>
</Style>
<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 连接到字符串变量,直到找到<Folder>
节点
因此输出字符串将是:
""<kml xmlns="http://www.opengis.net/kml/2.2"><Document><Name>TestDoc</Name><Style id="Style1"><PolyStyle><fill>0</fill></PolyStyle> </Style>"
我是 xml 新手 ..Plz 帮助