Writing formatted XML with XmlWriter
You can customize the xml output via the XmlWriterSettings.
You didn't include any code, but you can set the XmlWriterSettings when you create the XmlWriter. You can also just use something like:
var myXmlWriter = new XmlWriterSettings { Indent = true };
I suspect you need to create an XmlWriterSettings
with the behaviour you want (indentation etc) and then pass that to the XmlWriter
on creation. Just setting Indent
to true may well be enough:
XmlWriterSettings settings = new XmlWriterSettings { Indent = true };
using (XmlWriter writer = XmlWriter.Create(..., settings))
{
...
}