【发布时间】:2018-07-19 09:16:10
【问题描述】:
我正在使用 XMLDocumnet 创建 XML 文件。但是对于界面,我需要将它们共享为平面文件。 请帮忙。
XmlDocument doc1 = new XmlDocument();
string loadFilePath = Server.MapPath("~\\temp\\IC35181.xml");
doc1.Load(loadFilePath);
doc1.Save(Server.MapPath("~\\temp\\IC35181.xml"));
File.Copy(Server.MapPath("~\\temp\\IC35181.xml"), Server.MapPath("~\\temp\\IC35181_" + DateTime.Now.ToString("yyyyMMdd") + "_0" + (++k).ToString().PadLeft(4, '0') + ".xml"), true);
doc1.DocumentElement.ParentNode.RemoveAll();
File.WriteAllText(Server.MapPath("~\\temp\\IC35181.xml"), string.Empty);
File.Copy(Server.MapPath("~\\XMLRootTag.xml"),Server.MapPath("~\\temp\\IC35181.xml"), true);
【问题讨论】:
-
您遇到的错误是什么
-
没有出现错误,我正在格式化 XML,但我需要 Flat XML
标签: c# asp.net .net visual-studio .net-4.5