Public DataTable XLM_test (string path, string nodeName)
{
DataTable table = new DataTable ();
Table. Columns. Add ("EmployeeID", typeof (string ));
Table. Columns. Add ("EName", typeof (string ));
Table. Columns. Add ("ESex", typeof (string ));
Table. Columns. Add ("EAge", typeof (string ));
Table. Columns. Add ("EPlace", typeof (string ));
Table. Columns. Add ("EMoney", typeof (string ));
XmlDocument doc = new XmlDocument ();
Doc. Load (path );
// XmlNodeList xnl = doc. SelectSingleNode (nodeName). ChildNodes; // obtain all child nodes of the NewDataSet Node
XmlNodeList xnl = doc. SelectSingleNode ("NewDataSet"). ChildNodes; // obtain all child nodes of the NewDataSet Node
Foreach (XmlNode xn in xnl) // traverses all child nodes
{
XmlElement xe = (XmlElement) xn; // converts the subnode type to the XmlElement type
If (xe. Name = "Table") // you can specify the node Name as Table.
{
XmlNodeList xnlChild = xe. ChildNodes; // continue to obtain all the child nodes of the xe subnode
DataRow row = table. NewRow ();
Foreach (XmlNode xnChild in xnlChild) // traverse
{
XmlElement xeChild = (XmlElement) xnChild; // Conversion Type
// If (xeChild. Name = "EName ")
//{
// Row ["EName"] = xeChild. InnerText;
//}
Row [xeChild. Name] = xeChild. InnerText;
}
Table. Rows. Add (row );
}
}
Return table;
}
========================
WebBrowser1.Navigate ()