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

Jason Hunter jhunter at collab.net
Tue Sep 12 15:39:38 PDT 2000


> I've been struggling with the fact that JDOM trees include or exclude
> whitespace depending on the presence or absence of a DTD.

It's a fact of life when dealing with XML.  Whether you validate or not
changes the document you end up with.  I have lots of opinions on the
issue, but I don't have time to hop on a soapbox.

> Since XMLOutputter has options to add formatting to the output 
> XML file, I thought it should also have an option to remove 
> (old) formatting as well.

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.

-jh-



More information about the jdom-interest mailing list