I got this error:
Empty path name is not legal.
What is the problem with my code?
StringBuilder writer = new StringBuilder();
XmlWriterSettings settings = new XmlWriterSettings() { OmitXmlDeclaration = true };
XmlWriter xmlWriter = XmlWriter.Create(strXML, settings);
xmlDoc.Save(xmlWriter);
strXML = writer.ToString();
It is not clear what you’re trying to accomplish – the code sample provided doesn’t actually compile.
However, this does and seems to have no issues: