[jdom-interest] XMLOutputter and newlinesafterdeclaration/doctype

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Dec 19 14:18:37 PST 2002

At 3:52 PM -0500 12/19/02, Eric Rosenberg wrote:
>If it doesn't matter then why are you so opposed to the newlines not 
>being there?

I'm not so much opposed to it not being there as to adding any 
complexity to the API to support it not being there.

>Why is it an invalid use of JDOM to use it to build an xml document 
>and return it, and to also dump the message to a log file? 
>Obviously, the log file isn't a valid xml document, nor should it 
>be. That doesn't mean that someone wouldn't want to be able process 
>that log file in some way with a script.

They can do that if they want to. Just don't tell me I have to make 
JDOM more complex to support that.

>You say that there is a lot of things that XML Outputter produces 
>that you can't control. But are there other cases where XML 
>Outputter says it does something, but actually only sorta does that 
>thing with some exceptions?

There may be a documentation problem here. However, the intent of all 
the indenting methods is clear: add additional significant white 
space to pretty up the document. What Vadim is asking for is very 
different. I think the default behavior should be to add additional, 
insignificant white space where possible (e.g. inside tags and the 
prolog) to make the output reasonably editable in text editors. This 
is an explicit goal of XML. I see no reason not to do that. Giving 
Vadim what he asked for, would make JDOM less attractive for most 
developers. Giving him an option to do that would make JDOM more 
complex for everyone. It's just not worth it. He can do everything he 
wants to do by subclassing or other means that have been suggested. 
There's no reason to uglify the core API with this very special case.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |

More information about the jdom-interest mailing list