0
我是新来的XML在.net中,我有这个需求,我需要在XML文件中搜索。例如,我有这个XML文件。使用.net查询XML(需要帮助)
<?xml version="1.0" encoding="utf-8"?>
<Books>
<Book>
<Title>Sample book1</Title>
</Book>
<Book>
<Title>Sample book2</Title>
</Book>
<Book>
<Title>Another book</Title>
再举例来说,我用的是“样品”作为搜索键,以便输出将样品BOOK1和样品第二册。如果我使用“book”作为搜索关键字,输出将是Sample book1,Sample book2和另一本书。
从我现在所拥有的基础来看,这似乎是不可能的。
Dim xmlDocument As New XmlDocument()
Dim _xmlDataSource As New XmlDataSource
xmlDocument.Load(Server.MapPath("XML/Books.xml"))
Dim node = xmlDocument.DocumentElement.SelectSingleNode("./Books/Book[@title='SearchKey']")
这是可能的.net?如果我的XML文件格式正确,您是否也可以查看要求?
在此先感谢