我收到了这个错误:
空路径名称不合法。
我的代码有什么问题?
StringBuilder writer = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings() { OmitXmlDeclaration = true };
XmlWriter xmlWriter = XmlWriter.Create(strXML, settings);
xmlDoc.Save(xmlWriter);
strXML = writer.ToString();
答案 0 :(得分:2)
目前尚不清楚您要完成的任务 - 提供的代码示例实际上并未编译。
然而,这确实并且似乎没有问题:
XmlDocument xmlDoc = new XmlDocument();
XmlWriterSettings settings = new XmlWriterSettings() { OmitXmlDeclaration = true };
XmlWriter xmlWriter = XmlWriter.Create("xml.txt", settings);
xmlDoc.Save(xmlWriter);