解决方案 »

  1.   

    获取节点的属性集合,使用for或者foreach循环属性添加。
    参见:http://blog.csdn.net/duanzi_peng/article/details/24018431
      

  2.   


    不用linq 使用 System.xml 能操作吗  我要封装 XmlHelper类“System.Xml.XmlElement”不包含采用“5”个参数的构造函数
      

  3.   


    不用linq 使用 System.xml 能操作吗  我要封装 XmlHelper类“System.Xml.XmlElement”不包含采用“5”个参数的构造函数
     xmlDoc.Load(XmlPath);
                    XmlNode root = xmlDoc.SelectSingleNode("fileinfo");//查找<fileinfo>
                    XmlElement xe = xmlDoc.CreateElement("files");//创建一个<files>节点
                    xe.SetAttribute("ChangeType", ((int)file.ChangeType).ToString());
                    xe.SetAttribute("FullPath", file.FullPath.ToString());
                    xe.SetAttribute("Name", file.Name.ToString());
                    xe.SetAttribute("IsFile", file.IsFile.ToString());
                    root.AppendChild(xe);//添加到<files>节点中
                    xmlDoc.Save("FilesInfo.xml");把这段代码封装