[jdom-interest] Modified XMLOutputter which optionally omits white space

Brad Morgan Brad.Morgan at e-pubcorp.com
Tue Sep 12 16:14:04 PDT 2000

> You mean you want a setOmitWhitespace() method apparently by looking at
> your diff.  Something that prints the trimmed value instead of the raw
> value.  Something like that should be part of a larger "how do we deal
> with XMLOutputter now that we preserve whitespace" issue.  We still have
> the problem that manually created elts or elts moved around are going to
> have seriously inconsistent indentation compared to the original elts.

I think my changes address the problem of manually created elts or elts
having inconsistent indentation.  If I use my new constructor:

XMLOutputter("    ",true,true);

I have asked XMLOutputter to properly indent the output adding spacing and
newlines where it wants and also to remove the old, probably incorrect,
formatting (my new code).

In my limited testing it appears to do the right thing.

I'm happy with a larger, better solution, but this one appears to be small
and slightly better for now.



More information about the jdom-interest mailing list