[jdom-interest] XMLOutputter line breaks and TextMode.PRESERVE

Christian Migowski chrismfwrd at gmail.com
Mon Aug 17 01:49:06 PDT 2009


to my big disappointment I found out that the XMLOutputter when configured with

xmlSerializer = new

doubles CR (carriage return) line breaks in the output, i.e. if I have
an element

<data>first line\r\nsecond line</data>

will be outputted as

<data>first line&#xD;\r\nsecond line</data>

This results in a double CR if read in again with a different XML
parser (libxml2 for example).

I found an explanation in
http://www.jdom.org/pipermail/jdom-interest/2003-July/012593.html but
I miss the point in this processing?!
What does TextMode.PRESERVE - which is the default according to the
Javadoc - really mean (as it obviously doesn't preserve the text)?
How can I really preserve the text in elements as-it-is?

thanks in advance & best regards,

More information about the jdom-interest mailing list