zoukankan      html  css  js  c++  java
  • c# 创建XML文件

    using  System.Xml;

    using System.Xml.Schema;

    private void button2_Click(object sender, EventArgs e)

            {
                XmlTextWriter xmlWriter = new XmlTextWriter("D:""my.xml", Encoding.Default);//创建一个xml文档
               xmlWriter.Formatting = Formatting.Indented;
               xmlWriter.WriteStartDocument();
               //写特殊项目,如XSL链接
               xmlWriter.WriteProcessingInstruction("xml-stylesheet", "type=""text/xsl"" href=""rss.xsl""");
               //写入根节点
               xmlWriter.WriteStartElement("根");
               //写入节点
               xmlWriter.WriteStartElement("日期");
               //写入内容
               xmlWriter.WriteString(System.DateTime.Now.Year+"-"+System.DateTime.Now.Month+"-"+System.DateTime.Now.Day);
               xmlWriter.WriteEndElement();
               xmlWriter.WriteEndElement();
               xmlWriter.Close();

            }
  • 相关阅读:
    java中的Set的使用以及各种遍历方法(较为全面)
    系统图标
    监听按钮
    GUI
    【Avalon】获取隐藏元素的尺寸
    Hooks
    特性节点Attribute
    ngCloak
    邮件
    时间
  • 原文地址:https://www.cnblogs.com/baishahe/p/1287333.html
Copyright © 2011-2022 走看看