标签:
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);
标签:
原文地址:http://www.cnblogs.com/ssjsk/p/5499799.html