[jdom-interest] XMLOutputter

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Feb 12 07:26:00 PST 2004


At 8:00 AM -0500 2/12/04, Rolf Lear wrote:
>You have a bunch of problems ....
>
>Firstly, white-space in XML has no meaning unless specifically requested
>(xml:space="preserve"). Thus, the following two XML documents are
>equivalent:
><root><element>text</element></root>
>and
><root>
>   <element>text</element>
></root>
>

This statement is false. The two document above are *not* equivalent, 
at least at the level of XML.

Conformant XML parsers preserve and report all white space in XML 
content (i.e. outside of tags) regardless of the setting of 
xml:space, or its presence or absence. The interpretation of that 
white space is an aplicaiton level decision made by each program that 
reads the XML through a parser, as in the interpreation of any other 
non-whitespace data. See Chapter 10 of Effective XML for more 
elaboration of this point.

-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA



More information about the jdom-interest mailing list