[jdom-interest] XMLOutputter help needed.

Jason Hunter jhunter at collab.net
Thu Mar 29 09:57:08 PST 2001

Alex Colic wrote:
> Hi,
> I have an xml document that a class reads, makes some changes to and then
> saves. I have been using:
>   XMLOutputter out=new XMLOutputter("  ", true);
> to indent the lines two spaces and to add a new line.
> The problem is that as the file is read and saved the indentation is
> commutative. First the indent is two spaces, then four spaces etc.
> Any idea on what I can do to prevent that?

setTrimText(true) which allows the outputter to trim whitespace before
adding its own.  Make sure you use the latest version.  I made
improvements on this since beta6.  It's not 100% perfectly formatted
now, but it's pretty dang good and I'll get it perfect.


More information about the jdom-interest mailing list