![](/img/trans.png)
[英]How to loop through all nodes in XML and change node value based on its value in C#?
[英]How to query XML nodes based on the value of the attribute of its parent node
我有一個看起來像這樣的XML:
<Library>
<Author Name = "JRR Tolkien">
<Book Title = "Lord Of the Rings" />
<Book Title = "The Hobbit" />
</Author>
<Author Name = "JK Rowling">
<Book Title = "Harry Potter and the Sorcerers Stone" />
<Book Title = "Harry Potter and the Prisoner of Azkaban" />
</Author>
</Library>
XPath是什么,用於選擇其父“ Author”節點的值為“ JK Rowling”的所有“ Book”節點?
這是最直觀,最嚴格的選擇,將所有具有“ Author
Name
屬性為'JK Rowling'
Author
'JK Rowling'
選為父本。 並且Author
還必須擁有Library
作為父母。
/Library/Author[@Name='JK Rowling']/Book
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.