[jdom-interest] PrintWriter in XMLOutputter
Jason Hunter
jhunter at collab.net
Tue Jun 20 11:45:47 PDT 2000
> I've uploaded a new version of XMLOutputter to
>
> http://metalab.unc.edu/xml/jdom/XMLOutputter.java
>
> 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.
Just checked it in.
> 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
> people think?
>
> 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.
Another reason to use \r\n over \n is that it'll only cause issues for
Unix people who tend to be familiar with handling such issues. In other
words, every Unix user knows how to remove ^M's, but not every Windows
user know what to do when Notepad shows one long line. :-)
Are we sure that passing System.out to XMLOutputter on Unix will always
look right though?
-jh-
More information about the jdom-interest
mailing list