Using system;
Using system. Collections. Generic;
Using system. text;
Using system. xml;
Using system. Data;
Using system. xml. XPath;
Using system. IO;
Namespace testxpath
...{
Class xmlopretion
...{
/** // <Summary>
/// Recieve XML return datatable, static method
/// </Summary>
/// <Param name = "url"> the path of XML document
/// </Parm>
Public static datatable filldt (string URL)
...{
Streamreader sr = new streamreader (URL );
Xmldatadocument XD = new xmldatadocument ();
XD. dataset. readxml (SR );
Datatable dt = XD. dataset. Tables [0];
XD = NULL;
Sr. Close ();
Return DT;
}
/** // <Summary>
/// Recieve XML, the XPath, return xpathnodeiterator, static method
/// </Summary>
/// <Param name = "url"> the path of XML document
/// </Parm>
/// <Param name = "xpathselect"> the XPath Select sentence </param>
Public static xpathnodeiterator xpathiter (string URL, string xpathselect)
...{
Streamreader sr = new streamreader (URL );
Xpathdocument Doc = new xpathdocument (SR );
Xpathnavigator mynav = Doc. createnavigator ();
Xpathnodeiterator myiter = mynav. Select (xpathselect );
Doc = NULL;
Sr. Close ();
Return myiter;
}
}
}