[jdom-interest] XMLOutputter and newlinesafterdeclaration/doctype

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Dec 19 12:23:36 PST 2002


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.
-- 

+-----------------------+------------------------+-------------------+
| 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