要理解這些類的用法
using System
using System
這個示例使用了文件booksxpath
private void button
{
//modify to match your path structure
XPathDocument doc=new XPathDocument(
//create the XPath navigator
XPathNavigator nav=doc
//create the XPathNodeIterator of book nodes
// that have genre attribute value of novel
XPathNodeIterator iter=nav
while(iter
{
LoadBook(iter
}
}
private void LoadBook(XPathNavigator lstNav)
{
//We are passed an XPathNavigator of a particular book node
//we will select all of the descendents and
//load the list box with the names and values
XPathNodeIterator iterBook=lstNav
(XPathNodeType
while(iterBook
listBox
+ iterBook
}
在button
XPathNavigator nav = doc
本例用Select方法獲取genre屬性值為novel的所有節點
要把數據加載到列表框中
LoadBook()方法提取這個XPathNavigator
然後
[
From:http://tw.wingwit.com/Article/program/net/201311/14664.html