特定の属性値を持つ特定の位置にノードを見つける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」があります。 私は、著者名が「John」であるすべての本を探したいと思います。
.NET XPathDocumentを使用しています。
あなたの式は本に限定されるものではありません。 –
@Ben:修正されました。 – Richard