zoukankan      html  css  js  c++  java
  • c# 创建xml

    XmlDocument xmldoc = new XmlDocument();
    XmlDeclaration xmldecl;
    xmldecl = xmldoc.CreateXmlDeclaration("1.0", "utf-8", null);
    xmldoc.AppendChild(xmldecl);

    //加入一个根元素 root
    XmlElement xmlelem = xmldoc.CreateElement("", "root", "");
    xmldoc.AppendChild(xmlelem);

    XmlNode root = xmldoc.SelectSingleNode("root");

    XmlElement sourceSystem = xmldoc.CreateElement("sourceSystem");//创建节点
    sourceSystem.InnerText = "AVID";
    root.AppendChild(sourceSystem);

    XmlElement fileName = xmldoc.CreateElement("fileName");//创建节点
    fileName.InnerText = ti.ProgramTitle;
    root.AppendChild(fileName);

    XmlElement filePath = xmldoc.CreateElement("filePath");//创建节点
    filePath.InnerText = ti.TranscodeFileName;
    root.AppendChild(fileName);

    XmlElement fileMd5 = xmldoc.CreateElement("fileMd5");//创建节点
    root.AppendChild(fileMd5);

    string path ="d:\1.xml";

    xmldoc.save(path);

    欲成为海洋大师,必知晓海中每一滴水的真名!
  • 相关阅读:
    JQuery源码解析(十一)
    Oracle帮助类
    JQuery正则验证
    MVC的过滤器
    JQuery源码解析(十)
    JavaScript封装的几种方式
    ps小技巧
    Fragment 的用法小技巧
    onCreateOptionsMenu 和 onPrepareOptionsMenu 的区别
    Axure 注册码
  • 原文地址:https://www.cnblogs.com/ssjsk/p/5499799.html
Copyright © 2011-2022 走看看