XMLPrinter::ClearBuffer() resets _firstElement
Brought to you by:
leethomason
XMLPrinter::ClearBuffer sets _ firstElement to true. That leads to the suppression of linebreaks in successive uses of XMLPrinter.
This is relevant when buffering the output of XMLPrinter. In detail: The only way to make XMLPrinter write to an std::ostream while not keeping the entire document in memory is to regularly flush the contents of XMLPrinter::CStr() to the ostream - even when only halfway through the document - followed by a call to XMLPrinter::ClearBuffer().
The solution is to remove the line setting "firstElement = true" in XMLPrinter::ClearBuffer. I'm happy to provide a pull request if you point me to where I can do that.