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);//保存文件

posted on 2015-08-24 11:35  水苗  阅读(291)  评论(0编辑  收藏  举报