检索XML属性... [英] Retrieving XML attributes...
本文介绍了检索XML属性...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用-
阅读以下XML结构
XPATH:"//root/node1 [@value]/node2":
I am reading the following XML structure, using -
XPATH: "//root/node1[@value]/node2":
<root>
<node1 value="abc">
<node2 value="def" />
<node2 value="ghi" />
<node2 value="jkl" />
</node1>
</root>
如果来自"node2"的数据满足某些条件,则必须使用来自"node1"的数据.
如果满足"node2"信息的条件,如何访问"node1"属性?
I have to use data from "node1" if the data from "node2" satisfies certain conditions.
If the conditions for "node2" information are met, how do I access the "node1" attribute?
推荐答案
使用" LINQ to XML " .
看看下面的链接.
http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx
http://www.joe-stevens.com/2010/01/08 /linq-to-xml-tutorial/
Using "LINQ to XML".
Have a look at below links.
http://www.hookedonlinq.com/LINQtoXML5MinuteOverview.ashx
http://www.joe-stevens.com/2010/01/08/linq-to-xml-tutorial/
除了其他解决方案之外,请考虑使用HTML Agility Pack:
http://htmlagilitypack.codeplex.com/ [ ^ ]
In addition to other solutions, consider using Html Agility Pack :
http://htmlagilitypack.codeplex.com/[^]
这篇关于检索XML属性...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文