现有XML格式如下:
<?xml version="1.0" encoding="utf-8"?>
<resultlist type="xe" total="200" skip="0">
<xe>
     <id>1234</id>
             <ori id="8745">中国</street>
</xe>请问如何提取成为:
1234
中国
谢谢了  菜鸟求助~~~~

解决方案 »

  1.   

    XmlDocument doc = new XmlDocument();
    doc.Load("xxx.xml");
    XmlNode n = doc.SelectSingleNode("//xe/id");
    if(n!=null) n.InnerText就是n = doc.SelectSingleNode("//xe/ori");
    if(n!=null) n.InnerText就是
      

  2.   

    多个xe,你可以循序XmlNodeList ns = doc.SelectNodes("//xe");
    foreach(XmlNode n in ns)
    {
     XmlNode x = n.SelectSingleNode("id");
     //x.InnerText; 
    x = n.SelectSingleNode("ori");
     }