我有一個像下面的XML文檔:獲得一個搜索關鍵字的前一個節點在XML
<bookstore>
<book>
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<book>
<title>Zen and the Art of Motorcycle Maintenance</title>
<author>
<first-name>Robert</first-name>
<last-name>Pirsig</last-name>
</author>
<price>5.99</price>
</book>
<book>
<title>Other Cities</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Rosenbaum</last-name>
</author>
<price>9.99</price>
</book>
</bookstore>
當然,書店有超過一成書,所以二要搜索的作者,然後爲包含搜索的作者姓名的書籍節點返回XElement
。
只是第一個''節點或所有匹配的''節點? –
Kev
2011-06-14 16:08:16