This uses Writer instead of PrintWriter and doesn't suppress
IOExceptions. I tested this against all the examples in my upcoming
talk and it seemed to be bug-for-bug compatible with the old version.
The one open question in this version is what to use for a line
separator. Right now I'm using \r\n since that's most cross-platform
compatible and friendliest to various network protocols. However, \n
alone might be slightly friendlier to XML parsers. Another
possibility is to ask for System.getProperty("line.separator").
However, I'm loathe to make the output platform dependent. What do
The value used is stored in a private field called newline so it's
easy to change, if it turns out I've made the wrong choice here.