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; ;//获取NewDataSet节点的所有子节点
XmlNodeList xnl = doc.SelectSingleNode("NewDataSet").ChildNodes; ;//获取NewDataSet节点的所有子节点
foreach (XmlNode xn in xnl)//遍历所有子节点
{
XmlElement xe = (XmlElement)xn;//将子节点类型转换为XmlElement类型
if (xe.Name == "Table")//判断节点名为Table
{
XmlNodeList xnlChild = xe.ChildNodes;//继续获取xe子节点的所有子节点
DataRow row = table.NewRow();
foreach (XmlNode xnChild in xnlChild)//遍历
{
XmlElement xeChild = (XmlElement)xnChild;//转换类型
//if (xeChild.Name == "EName")
//{
// row["EName"] = xeChild.InnerText;
//}
row[xeChild.Name] = xeChild.InnerText;
}
table.Rows.Add(row);
}
}
return table;
}
=================
webBrowser1.Navigate()