[jdom-interest] XMLOutputter and newlinesafterdeclaration/doctype

Eric Rosenberg eric at computerwizards.com
Thu Dec 19 12:52:01 PST 2002

If it doesn't matter then why are you so opposed to the newlines 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.

I do this all the time. I have a servlet that uses JDOM to procuce XML 
that is returned to the client. I also dump the xml to tomcat's log file 
so that I can see what is being produced. How's that an inapropriate use 
of JDOM?

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 

Elliotte Rusty Harold wrote:

> At 2:57 PM -0500 12/19/02, Vadim Strizhevsky wrote:
>> Well that's the root of the disagreement really. I say it does matter,
>> you say it doesn't.
> No, you say it does matter; the XML specification says it doesn't 
> matter. This only matters to you because you're not using XML tools to 
> process your data.
>> All I was asking for was a way to control the space that is outside the
>> root element. Since the XMLOutputer produces it, it seemed logical to me
>> for it to have such control over it. And the resulting XML would _still_
>> be valid xml.
> There are a lot of other things XML Outputter produces but doesn't let 
> you control: the white space inside tags, the quotes around attribute 
> values, exactly how characters outside the current character set are 
> escaped, and more.
> What unifies all of these is that in an XML process, none of it 
> matters. If you're processing XML, the parser isn't even going to tell 
> you about this stuff. If a process needs to know this stuff, then that 
> process is broken. Any way JDOM solves these issues is acceptable. Any 
> added complexity to allow such things to be controlled is not 
> beneficial and actively harmful because it teaches people the wrong 
> lessons about XML.
> I see a lot of developers who cause themselves a lot of grief by not 
> understanding the difference between syntax sugar and the document's 
> genuine data. In effect, you're asking us to make it easier for you to 
> do the wrong thing. We won't do that. JDOM should make the right 
> solution easy and the wrong solutions difficult to impossible.

More information about the jdom-interest mailing list