从XDocument xml获取XElement Child emelemts值 [英] Get XElement Child emelemts value from a XDocument xml
本文介绍了从XDocument xml获取XElement Child emelemts值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我非常需要知道如何从Xml获取子元素和属性,为此我正在使用XDocument.我在这里添加了XML.我必须获得点"元素集合的图像元素.
在此先感谢
Monish K M
示例:
Hi,
I badly need to know that how to get child elements and attributes from a Xml.I am using XDocument for this matter.I have added XML here with. i have to get Image elelment of ''Point'' Elements collections.
Thanks in advance
Monish K M
Example:
<Root>
<image FileIndex="1"/>
<Point x="2" y="3" text="Head"/>
<Point x="10" y="50" text="Leg"/>
<Point x="20" y="50" text="Neck"/>
</image>
<image FileIndex="2"/>
<Point x="10" y="30" text="Head"/>
<Point x="1" y="5" text="Leg"/>
<Point x="2" y="5" text="Neck"/>
</image>
<image FileIndex="3">
<Point x="8" y="3" text="Head"/>
<Point x="11" y="50" text="Leg"/>
<Point x="25" y="50" text="Neck"/>
</image>
</Root>
推荐答案
选中此链接.您会得到一个主意.您必须对xml使用相同的概念
http://www.techrepublic.com/Blog/programming-and-development/access-xml-data-using-linq-to-xml/594 [
Check this link. You will get an idea. You have to use the same concept for your xml
http://www.techrepublic.com/blog/programming-and-development/access-xml-data-using-linq-to-xml/594[^]
这篇关于从XDocument xml获取XElement Child emelemts值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文