XmlDocument xmlDoc = new XmlDocument();

XmlDeclaration declaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", "yes");//第一个参数为版本,必须为1.0;第二个参数为编码方式,一般设置为UTF-8;第三个参数的值为yes或否no

xmlDoc.AppendChild(declaration);

XmlNode root = xmlDoc.CreateNode(XmlNodeType.Element, "AgentBillMonth", null);//AgentBillMonth为父节点名

xmlDoc.AppendChild(root);

xmlDoc.Save(sFilePath);//保存文件

相关文章:

  • 2022-02-20
  • 2021-08-22
  • 2021-09-13
  • 2022-12-23
  • 2021-08-21
  • 2021-10-27
  • 2021-04-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-01-03
  • 2021-10-25
相关资源
相似解决方案