您好不知道这是可以做到,但我知道这里有人会知道:)
Hi Not sure if this can be done but I know someone here will know :)
使用
XElement oNodeEquip = xmlDoc.XPathSelectElement("//ItemAry/Item/Equip");
怎么会在下面的第二个我选择装备:
how would I select Equip from the second in the following:
<TestInfo>
<ItemAry>
<Item>
<testData>ABC</testData>
</Item>
<Item>
<testData>XYZ</testData>
<Equip>xxx</Equip>
</Item>
</ItemAry>
</TestInfo>
总是会有在租赁2 &LT;项目&GT;
,我想从值将始终是在第二个节点&LT;项目&GT ;
there will always be at lease 2 <Item>
and the node I want the value from will always be in the second <Item>
这是使用.NET 4.0中一个WPF应用程序
this is a WPF app using .Net 4.0
试试这个XPath EX pression:
Try this XPath expression:
//ItemAry/Item[2]/Equip
这仅考虑第二个&LT;项目&GT;
元素