XmlDocument dom = new XmlDocument();dom.Load("your xml");string xpath = "//*[contains(@Text,'计算机')]";
XmlNodeList nodeList = dom.SelectNodes(xpath)foreach(XmlNode node in nodeList) {
.....
}
XmlNodeList nodeList = dom.SelectNodes(xpath)foreach(XmlNode node in nodeList) {
.....
}
string xpath = "//*[contains(@Text,'计算机')]";
这句什么意思?//代表转义?
string xpath = "//*[contains(@Text,'计算机')]";
XmlNodeList nodeList = dom.SelectNodes(xpath)foreach(XmlNode node in nodeList) {
if(node.ElementName = "VocationTypeSon "){
string val = node.Attributes["Value"].Value; /*获取节点的value属性值 e.g 2001*/
string text = node.Attributes["Value"].Text; /*获取节点的text属性值 e.g 计算机工程师*/
/*生成你自己的table, dataset, array*/
}}