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文件格式正確,您是否也可以查看要求?
在此先感謝