XML 文件如下所示<osm version="0.6" generator="CGImap 0.0.2"> <bounds minlat="54.0889580" minlon="12.2487570" maxlat="54.0913900" maxlon="12.2524800"/> <node id="298884269" lat="54.0901746" lon="12.2482632" user="SvenHRO" uid="46882" visible="true" version="1" changeset="676636" timestamp="2008-09-21T21:37:45Z"/> <node id="261728686" lat="54.0906309" lon="12.2441924" user="PikoWinter" uid="36744" visible="true" version="1" changeset="323878" timestamp="2008-05-03T13:39:23Z"/> <way id="11103644" visible="true" version="22" changeset="57021161" timestamp="2018-03-09T06:06:21Z" user="thetornado76" uid="1624486"> <nd ref="5058358201"/> <nd ref="5058358200"/> <nd ref="459672758"/> <nd ref="459672757"/> <nd ref="459672756"/> <tag k="bicycle" v="no"/> <tag k="destination" v="Airport"/> </way> <way id="11103973" visible="true" version="1" changeset="410956" timestamp="2007-11-05T15:10:28Z" user="DaveHansenTiger" uid="7168"> <nd ref="98983980"/> <nd ref="98983981"/> <tag k="tiger:source" v="tiger_import_dch_v0.6_20070809"/> <tag k="tiger:tlid" v="116306702"/> <tag k="tiger:upload_uuid" v="bulk_upload.pl-bcfe2a6c-15d8-4c58-8cb2-f0d6e1120159"/> </way></osm>这是我到目前为止//Removes the "tag" element from xmlosmFile.Root.Elements().Elements().Where(x => x.Name == "tag").Remove();//Each iteration of query has the an entire <way> elements and all its childrenvar query = from c in osmFile.Root.Elements("way") select c;我的问题是,如何才能使遍历查询的每次迭代仅具有特定方式的 nd 元素的所有属性值?例如,如果我这样做foreach (var x in query) MessageBox.Show(x.ToString());第一次迭代将显示50583582015058358200459672758459672757459672756第二个会显示9898398098983981另外,有没有办法在不首先删除所有标签元素的情况下实现这一点?
2 回答
- 2 回答
- 0 关注
- 146 浏览
添加回答
举报
0/150
提交
取消