[jdom-interest] XMLOutputter and newlines after declaration/doctype

Vadim Strizhevsky Vadim.Strizhevsky at morganstanley.com
Wed Dec 18 12:55:21 PST 2002

Currently (in latest CVS that I had access to) XMLOutputter always
prints out new lines after declaration and DOCTYPE, no matter what the
newline option is set to. There's even comment in the code stating that
this done on purpose because its looks better and is sematically

I'd like to request an ability to output the whole xml as one line,
without any newlines, (except the final one I guess). Either controlled
by the same flag as other new lines or a separate boolean flag. While I
do agree that having them there is sematically inconsequential, there
are situations and non-semantic reasons when you may want to really have
xml output as a single line. You want doc as small a possible. Or you
want to generating a big log file of multiple xml messages that will
later be processes by scripts. Having the complete message on a single
line would simplify those scripts.

For now I will have XMLOutputter subclass that duplicates
printDeclaration and printDocType methods and doesn't print the newlines
when newline option is set to false.

Also I noticed a signle use  of "\n" instead of lineSeparator in the
latest printDocType code.


This communication is intended for the addressee(s) and may contain
confidential and legally privileged information.  We do not waive
confidentiality or privilege by mistransmission.  If you have received
this communication in error, any use, dissemination, printing or copying
is strictly prohibited; please destroy all electronic and paper copies
and notify the sender immediately.

More information about the jdom-interest mailing list