[jdom-interest] Problem with XMLOutputter beta

Alex Rosen arosen at silverstream.com
Thu Jul 5 10:47:19 PDT 2001

> Do you have an algorithm in mind?

I mentioned my suggested algorithm here:

The summary is:

> For any element that has
> child elements, replace any text nodes that consist only of whitespace (or
> are empty) with the necessary newline+indent. (In other words, we only modify
> whitespace-only mixed content nodes.) There would also be a separate option
> normalize whitespace.

(When I talk about an empty text node, what I'm trying to say is that we should
ensure that the necessary newline+indent is added before every element,
comment, etc. If there's no text node before an element etc., then we pretend
that there's an empty text node there.)

I believe that this algorithm will pretty-print any file as well as the current
algorithm does, and is guaranteed not to lose data for applications that don't
use mixed content. (For applications that do use mixed content, and where
whitespace is significant, I don't think there's any way to pretty-print these
files without losing data (so you shouldn't pretty-print them.))


More information about the jdom-interest mailing list