I'm assuming you're saving the xml document by calling
XMLDocument::SaveFile(const char* filename, bool compact=false)
(or XMLDocument::SaveFile(FILE* fp, bool compact=false)
).
These methods use the XMLPrinter
class which writes 4 spaces for the indentation of elements (method XMLPrinter::PrintSpace
). You can suppress writing of indentation and newlines by passing true
for the compact
parameter to SaveFile
. Compact is preferred when passing xml directly from one application to another. And maybe your program will accept xml in this form.
Changing the indentation character(s) will require that you overload XMLPrinter
to provide your own implementation of PrintSpace
and overload XMLDocument
to use your XMLPrinter.
Note that whitespace (newlines and indentation) between elements in a XML document has no significance and will be (must be) ignored by conforming parsers. It is for human readability only.
PRESERVE_WHITESPACE
/ COLLAPSE_WHITESPACE
only affects how whitespace characters are handled in within the text node of an element.