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);

    欲成为海洋大师,必知晓海中每一滴水的真名!
  • 相关阅读:
    maven常用命令介绍(持续更新)
    JQ笔记
    AspNetPager学习使用2
    AspNetPager学习使用1
    VS2012添加ADO实体数据模型
    手动拍摄0008
    程序自动拍摄0007
    曝光补偿0006
    白平衡0005
    感光度0004
  • 原文地址:https://www.cnblogs.com/ssjsk/p/5499799.html
Copyright © 2011-2022 走看看