我想从一个看起来像这样的文件中读取文本:
Look up for : Bergwald Elsa-Brändström-Str
http://www.overpass-api.de/
output:
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2015-07-08T07:36:02Z"/>
<node id="2505961536" lat="48.9722935" lon="8.4618593">
<tag k="bus" v="yes"/>
<tag k="highway" v="bus_stop"/>
<tag k="name" v="Elsa-Brändström-Straße"/>
<tag k="network" v="Karlsruher Verkehrsverbund (KVV)"/>
<tag k="operator" v="Verkehrsbetriebe Karlsruhe"/>
<tag k="public_transport" v="stop_position"/>
</node>
</osm>
Look up for : Bergwald Hooverstraße
http://www.overpass-api.de/
output:
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="Overpass API">
<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>
<meta osm_base="2015-07-08T07:36:02Z"/>
<node id="2505961539" lat="48.9741500" lon="8.4640651">
<tag k="bus" v="yes"/>
<tag k="highway" v="bus_stop"/>
<tag k="name" v="Hooverstraße"/>
<tag k="network" v="Karlsruher Verkehrsverbund (KVV)"/>
<tag k="operator" v="Verkehrsbetriebe Karlsruhe"/>
<tag k="public_transport" v="stop_position"/>
</node>
</osm>
首先,我必须提取Look up for :之后的字符串。然后我必须提取属于第一个提取字符串的部分,该字符串从标记osm version=开始并在标记osm处结束。我想用 xml 解析器解析这部分。
在查找 :之后,我找不到可以将每个提取的字符串值与其所属输出匹配的任何解决方案。
有没有人有任何想法?
最好的问候, 纳扎尔