• 创建xml文档


            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(Server.MapPath("XMLFile.xml"));
            XmlNode root = xmlDoc.SelectSingleNode("Books");
            XmlElement book = xmlDoc.CreateElement("Book");

            XmlElement title = xmlDoc.CreateElement("Title");
            title.InnerText = "XML";
            book.AppendChild(title);
            XmlAttribute attr = xmlDoc.CreateAttribute("attr");
            attr.Value = "111";
            title.Attributes.Append(attr);

            XmlElement isbn = xmlDoc.CreateElement("ISBN");
            isbn.InnerText = "333333";
            book.AppendChild(isbn);
            XmlElement author = xmlDoc.CreateElement("Author");
            author.InnerText = "snow";
            book.AppendChild(author);
            XmlElement price = xmlDoc.CreateElement("Price");
            price.InnerText = "120";
            price.SetAttribute("Unit", "FCKpd___0quot");
            book.AppendChild(price);
            root.AppendChild(book);
            xmlDoc.Save(Server.MapPath("XMLFile.xml"));

  • 相关阅读:
    OC
    OC
    核心动画
    核心动画
    核心动画
    数据存储1
    plsql语句基础
    Oracle3连接&子查询&联合查询&分析函数
    oracle2约束添加&表复制&拼接
    Oracle表空间创建及表创建
  • 原文地址:https://www.cnblogs.com/citygs/p/1857903.html
Copyright © 2020-2023  润新知