zoukankan      html  css  js  c++  java
  • XmlWrite

    //创建XmlWriter实例
    using (XmlWriter xw = XmlWriter.Create(Server.MapPath("user.xml")))
    {
       xw.WriteComment("图书信息");//注释语句
       //根节点开始
       xw.WriteStartElement("Info");
       //定义子节点Record
       xw.WriteStartElement("Record");
       xw.WriteAttributeString("ID", "001");//附加属性
       xw.WriteElementString("Name", "小王");
       xw.WriteElementString("Tele", "1356578");
       xw.WriteEndElement();
       //定义子节点Record
       xw.WriteStartElement("Record");
       xw.WriteAttributeString("ID", "002");
       xw.WriteElementString("Name", "小刘");
       xw.WriteElementString("Tele", "1397568");
       xw.WriteEndElement();
       //根节点结束
       xw.WriteEndElement();
       Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('写入XML文件成功!');", true);
    }

  • 相关阅读:
    PyQt5 -1 最基本的小窗口
    浅谈线段树
    最小生成树问题
    最短路问题
    多重背包问题
    02背包(嘻嘻,完全背包)
    01背包例题
    背包问题(好奇怪)
    关于深搜及广搜
    搜索回溯(第二)
  • 原文地址:https://www.cnblogs.com/Yellowshorts/p/2869424.html
Copyright © 2011-2022 走看看