All my searches have brought up people asking the opposite, but I have a file which grows by nearly 50% if it is saved with line returns and indentation.
Is there any wa
Use XmlWriterSettings:
XmlDocument xmlDoc = new XmlDocument();
[...]
XmlWriterSettings xwsSettings = new XmlWriterSettings();
xwsSettings.Indent = false;
xwsSettings.NewLineChars = String.Empty;
using (XmlWriter xwWriter = XmlWriter.Create(@"c:\test.xml", xwsSettings))
xmlDoc.Save(xwWriter);
Try this code:
XmlDocument doc = new XmlDocument();
using(XmlTextWriter wr = new XmlTextWriter(fileName, Encoding.UTF8))
{
wr.Formatting = Formatting.None; // here's the trick !
doc.Save(wr);
}