本帖最后由 songyunyoo 于 2010-12-24 05:33:00 编辑

解决方案 »

  1.   

    XmlNodeList userList = xmlDoc.SelectNodes("/Users/User")
      

  2.   

    楼上正解
     xmlDoc.SelectSingleNode方法,一般是选中单个节点,如:xml的根节点。
      

  3.   

    依照这个方法写了,但是结果还是一样,第二个User节点找不到,只能找到第一个User
      

  4.   

    虽然userList 中有2个节点,但是遍历的时候就只有第一个了,这是为什么?
      

  5.   

    XmlNodeList userList = xmlDoc.SelectSingleNode("/Users/User").ChildNodes;
    foreach (XmlNode ul in userList)
    {
      XmlElement xe = (XmlElement)ul;
      if (xe.GetAttribute("LoginName") == "hahaha")//删除,固定了判断
      {}