选取特定Xml标记的值 [英] Picking the value of a specific Xml tag
本文介绍了选取特定Xml标记的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
?xml version = 1.0 encoding = UTF-8?>
< kml xmlns = http://www.opengis.net/kml/2.2 >
< Document>
< Placemark>
< name><![CDATA [s1]] > < / 名称 >
< description><![CDATA []] > < / description >
< Point>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78。 4449577331543 , 17 。 44826715453492 , 0 < / 坐标 >
< ; / 点 >
< / 地标 >
<地标>
< name><![CDATA []] > < / < span class =code-leadattribute> name >
< description><![CDATA []] > < / description >
< LineString>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78 。 44066619873047 , 17 。 44732551539346 , 0 78 。 4504508972168 , 17 。 449536312638212 , 0 78 。 4482192993164 , 17 。 440611077933813 , 0 78 。 4407091140747 , 17 。 44220782632188 , 0 78 。 44066619873047 , 17 。 44732551539346 , 0 < / coordinates >
< / LineString >
< / 地标 < span class =code-keyword>>
< Placemark>
< name><![CDATA [s2]] > < / 名称 >
< description><![CDATA []] > < / description >
< Point>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78。 45057964324951 , 17 。 449495372192157 , 0 < / 坐标 >
< ; / 点 >
< / 地标 >
<地标>
< name>
<![CDATA [s3]] >
< / 名称 >
< description>
<![CDATA []] >
< / < span class =code-leadattribute> description >
< Point>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78。 44950675964355 , 17 。 444991866993263 , 0 < / 坐标 >
< ; / 点 >
< / 地标 >
<地标>
< name>
<![CDATA [s4]] >
< / 名称 >
< description><![CDATA [] ] > < / description < span class =code-keyword>>
< Point>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78。 44817638397217 , 17 。 440611077933813 , 0 < / 坐标 >
< ; / 点 >
< / 地标 >
<地标>
< name><![CDATA []] > < / < span class =code-leadattribute> name >
< description><![CDATA []] > < / description >
< Point>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78。 44457149505615 , 17 。 4414708672646 , 0 < / 坐标 >
< ; / 点 >
< / 地标 >
<地标>
< name><![CDATA []] > < / < span class =code-leadattribute> name >
< description><![CDATA []] > < / description >
< Point>
< extrude> 1 < / extrude >
< altitudeMode> relativeToGround < / altitudeMode >
< coordinates> 78。 44075202941895 , 17 。 44220782632188 , 0 < / 坐标 >
< ; / 点 >
< / 地标 >
< / 文档 >
我想要获取''坐标的值''仅在'' LineString
''标记下标记。请告诉解决方案。
解决方案
请参阅以下链接
如何阅读XML node.Name和node.Value
在asp.net中读取xml节点
从XML C#中获取节点值
?xml version="1.0" encoding="UTF-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name><![CDATA[s1]]></name>
<description><![CDATA[]]></description>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>78.4449577331543,17.44826715453492,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name><![CDATA[]]></name>
<description><![CDATA[]]></description>
<LineString>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates> 78.44066619873047,17.44732551539346,0 78.4504508972168,17.449536312638212,0 78.4482192993164,17.440611077933813,0 78.4407091140747,17.44220782632188,0 78.44066619873047,17.44732551539346,0 </coordinates>
</LineString>
</Placemark>
<Placemark>
<name><![CDATA[s2]]></name>
<description><![CDATA[]]></description>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>78.45057964324951,17.449495372192157,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>
<![CDATA[s3]]>
</name>
<description>
<![CDATA[]]>
</description>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>78.44950675964355,17.444991866993263,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>
<![CDATA[s4]]>
</name>
<description><![CDATA[]]></description>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>78.44817638397217,17.440611077933813,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name><![CDATA[]]></name>
<description><![CDATA[]]></description>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>78.44457149505615,17.4414708672646,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name><![CDATA[]]></name>
<description><![CDATA[]]></description>
<Point>
<extrude>1</extrude>
<altitudeMode>relativeToGround</altitudeMode>
<coordinates>78.44075202941895,17.44220782632188,0</coordinates>
</Point>
</Placemark>
</Document>
I want to pick up the value of ''coordinates'' tag only under ''LineString
'' tag. Please tell the solution.
解决方案
Refer to links below
How to read XML node.Name and node.Value
Read a xml node in asp.net
Take Node Values From XML C#
这篇关于选取特定Xml标记的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文