我是 xml 新手。我正在尝试读取从 openstreetmaps 获取的 xml 文件。它看起来如下
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" generator="CGImap 0.0.2">
<bounds minlat="48.3994690" minlon="9.9897780" maxlat="48.3998220" maxlon="9.9898260"/>
<node id="149248718" lat="48.3994984" lon="9.9897961" user="Matthias Frank" uid="287306" visible="true" version="7" changeset="7966729" timestamp="2011-04-25T18:01:43Z"/>
<node id="1831376336" lat="48.3995041" lon="9.9898087" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:51Z"/>
<node id="1831376346" lat="48.3995599" lon="9.9902392" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:52Z"/>
<node id="1831376331" lat="48.3993243" lon="9.9898198" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:51Z"/>
<node id="1831376349" lat="48.3996127" lon="9.9906471" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:52Z"/>
<node id="1831376348" lat="48.3996044" lon="9.9910549" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:52Z"/>
<node id="1831376418" lat="48.4000685" lon="9.9897909" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:55Z"/>
<node id="1831376350" lat="48.3996158" lon="9.9908451" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:52Z"/>
<node id="1831376374" lat="48.3999450" lon="9.9897917" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:54Z"/>
<way id="172207897" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:02:59Z">
<nd ref="1831376348"/>
<nd ref="1831376350"/>
<nd ref="1831376349"/>
<nd ref="1831376346"/>
<nd ref="1831376336"/>
<tag k="bicycle" v="yes"/>
<tag k="highway" v="living_street"/>
<tag k="name" v="Hintere Rebengasse"/>
<tag k="oneway" v="yes"/>
</way>
<way id="172207928" user="NUP" uid="168758" visible="true" version="1" changeset="12345652" timestamp="2012-07-19T20:03:01Z">
<nd ref="1831376331"/>
<nd ref="1831376336"/>
<nd ref="1831376374"/>
<nd ref="1831376418"/>
<tag k="bicycle" v="yes"/>
<tag k="highway" v="living_street"/>
<tag k="name" v="Pfauengasse"/>
<tag k="oneway" v="yes"/>
</way>
</osm>
什么是读取数据的最简单和最短的方法,例如从我想要读取 id、lat、lon 的节点以及我想要保存该信息的每个节点。对于作为“方式”的元素,我想阅读附加到它的 ref 和“tag”元素。
我正在使用简单的 fstream,但它看起来不是最有效的方式。
请帮忙