有没有办法建立一个XPath查询,找到一个节点在某个位置,并与某个属性值?XPath查询,尊重节点位置和属性值
考虑下面的示例XML:
<Item Type="Book">
<!--1st Param node in a Book item is always the autors last name-->
<Param Value="Updike" />
<!--2nd Param node in a Book item is always the autors first name-->
<Param Value="John" />
<!--3rd Param node in a Book item is always the book title-->
<Param Value="Toward the End of Time" /></Item>
现在我可以构建查找以下一个查询:
找到类型“周易”的所有项目节点,其中第二Param节点具有值“”约翰“。 所以我想找到作者姓名为“John”的所有书籍。
请注意,我正在使用.NET XPathDocument。
你的表达并不局限于书籍。 – 2009-06-03 16:40:38