日期:2014-05-18  浏览次数:20834 次

求助,新手解析xml
<?xml version="1.0" encoding="GBK">
<root>
<QueryCondition>
<hpzl>01</hpzl>
<hphm>苏CM8879</hphm>
....
</QueryCondition>
</root>
</root>

我想取出 01和 苏CM8879

------解决方案--------------------
C# code
XmlDocument d = new XmlDocument();
d.Load(@"F:\1.xml");
XmlNodeList nodes = d.SelectNodes("//QueryCondition");
foreach (XmlNode x in nodes)
  MessageBox.Show(x["hpzl"].InnerText + " = " + x["hphm"].InnerText);