[jdom-interest] Re: bloated RC2 files - extra white space

Abe Mishler Abe at WhiteBeachStudios.com
Thu May 8 06:09:05 PDT 2003


> no reason for [white space] being outside as far as I can tell.

Aside from pretty indenting, of course...

Trimming preserves the data much better. Normalizing was just ... 
demoralizing? Here's the sick combination for getting just the right amount 
of whitespace outside of elements (for indenting) and preserving whitespace 
inside CDATA for anyone in the future:

XMLOutputter outputter = new XMLOutputter("  ", true, "ISO-8859-1");
outputter.setTextTrim(true);

Seems so basic... looks like 8 *was* doing more for us than 9 because with 
8 I didn't need the 2nd line.

Thanks,
Abe Mishler
White Beach Studios, USA





More information about the jdom-interest mailing list