I have a text file with the following data format
<create>
<way id="-200341" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-106862"/>
<nd ref="-106343"/>
<nd ref="-107240"/>
<nd ref="-107241"/>
<nd ref="-106863"/>
<nd ref="-106858"/>
<nd ref="-106866"/>
<nd ref="-106263"/>
<nd ref="-106868"/>
<nd ref="-106857"/>
<nd ref="-107242"/>
<nd ref="-106867"/>
<nd ref="-106865"/>
<nd ref="-107243"/>
<nd ref="-107244"/>
<nd ref="-106864"/>
<tag k="shelter" v="yes"/>
<tag k="highway" v="footway"/>
</way>
<way id="-200340" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-106853"/>
<nd ref="-106852"/>
<tag k="shelter" v="yes"/>
<tag k="highway" v="footway"/>
</way>
<way id="-200277" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-106228"/>
<nd ref="8236806130"/>
<tag k="highway" v="footway"/>
</way>
<way id="-200253" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-106766"/>
<nd ref="-106765"/>
<nd ref="-106226"/>
<nd ref="-106769"/>
<nd ref="-106228"/>
<nd ref="-106773"/>
<nd ref="-106230"/>
<nd ref="-106771"/>
<nd ref="-106768"/>
<tag k="highway" v="footway"/>
<tag k="shelter" v="yes"/>
</way>
<way id="-200219" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-107148"/>
<nd ref="-106747"/>
<tag k="shelter" v="yes"/>
<tag k="highway" v="footway"/>
</way>
<way id="-200218" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-106766"/>
<nd ref="-106755"/>
<tag k="shelter" v="yes"/>
<tag k="highway" v="footway"/>
</way>
<way id="-200066" version="0" timestamp="1970-01-01T00:00:00Z">
<nd ref="-106755"/>
<nd ref="-107148"/>
<nd ref="-106760"/>
<nd ref="-106764"/>
<nd ref="-106762"/>
<nd ref="-107115"/>
<nd ref="-106197"/>
<tag k="highway" v="footway"/>
<tag k="shelter" v="yes"/>
</way>
<way id="543558082" version="1" timestamp="2017-11-29T19:30:02Z" uid="0" user="">
<nd ref="1314909074"/>
<nd ref="5254615443"/>
<nd ref="5254615442"/>
<nd ref="5254615441"/>
<nd ref="5254615440"/>
<nd ref="-106516"/>
<nd ref="5254615439"/>
<nd ref="5254615438"/>
<nd ref="5254615437"/>
<nd ref="5254615436"/>
<nd ref="5254615435"/>
<tag k="service" v="driveway"/>
<tag k="highway" v="service"/>
<tag k="oneway" v="yes"/>
</way>
I have a unordered_map std::unordered_map<int, std::string> uMapID_feats{};
declared like this.
Assuming that my map has all of these ID numbers ref="XXXXX"
numbers stored, and a defaulted string stored in it, like "unknownplace".
what I want to do is map the ID (called "ref=XXXXXX
") to the tags that are listed under it. So the tags eg. for the first ID ref=106862
, the tags that are connected to it are 200341, shelter, highway, footway, yes
So in the map, the first 3 pairs would look like this:
"106862" , "200341,shelter,highway,footway,yes"
"106343" , "200341,shelter,highway,footway,yes"
"107240" , "200341,shelter,highway,footway,yes"
Some sets have more tags than others and some have only 2 tags, hence why I would like it all to be written to a string and stored in this unordered_map, the tags separated by commas.
How should I go about parsing this data and getting it stored in the unordered_map correctly?
any help is appreciated, thank you!