XML文档中如何读出例如<Question id="1" type="1" subject="1" score="3">id,type的值?

解决方案 »

  1.   

    找到节点 Question ,然后访问它的Attribute["type"],Attribute["id"]
      

  2.   

    Xmldocument xml = new Xmldocument();xml.LoadXml("你的XML字符串");1.xml.SelectSingleNode("Question").Attribute["名字"];2.xml.SelectSingleNode(xpath)我对 XPATH 很少用,你可以自己 查下 GOOGLE XPATH 有公式可以去。
      

  3.   

    http://blog.csdn.net/wf520pb/article/details/2644549
      

  4.   

    linq to xml 
    XElement xmlPage = XElement.Parse(xml);
        
      var query = from x in xmlPage.Descendants("item")
      select x.Attribute("id").Value;
      //属性