[jdom-interest] PrintWriter in XMLOutputter

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue Jun 20 10:17:16 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.

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.


+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list