Asp.net 如何使用XPath表达式检索XML数据
我有一个XMLDataSource,有点像:Asp.net 如何使用XPath表达式检索XML数据,asp.net,xml,xpath,Asp.net,Xml,Xpath,我有一个XMLDataSource,有点像: <bookstore> <author>author1</author> <publication>publication1</publication> <book> <genre>Thriller</genre> <name>ABC</name> </book> <book&g
<bookstore>
<author>author1</author>
<publication>publication1</publication>
<book>
<genre>Thriller</genre>
<name>ABC</name>
</book>
<book>
<genre>Romance</genre>
<name>XYZ</name>
</book>
<book>
<genre>Horror</genre>
<name>000</name>
</book>
</bookstore>
如果有人能帮助我,我将不胜感激。您可能需要添加/text()
来获取XML标记的内容,而不仅仅是标记。有一个很好的XML备忘单可以帮助您
我尝试使用XPath表达式
书店/书籍/流派[.=“浪漫”]
但不确定如何访问该值
标签
差不多。此XPath表达式:
/bookstore/book[genre='Romance']/name
字符串值:XYZ