摘要: XmlDocument myXml = new XmlDocument(); string mappath = Server.MapPath("../XML/DataConnection.xml");//获取xml 转换为物理路径 //加载指定的XML文件 myXml.Load(mappath); //添加新元素节点 XmlElement ele0 = myXml.CreateElement("SName"); //节点中添加属性 name 值为 方法接收的参数 value ele0.SetAttribute("Name", value); //另一个状态属性 state ele0.SetAttribute("state", "1");//状态 //获取根节点 XmlElement root = myXml.DocumentElement; //将新节点存储到元xml 中 r 阅读全文
posted @ 2012-02-10 12:00 梦想起航 阅读(744) 评论(0) 推荐(0) 编辑