Re: DOM L3 Core and L&S Comment/Question

At 2:58 PM +1000 1/7/03, Duncan_Stodart@insession.com wrote:
RE: "format-pretty-print" feature (for DOMWriter)

Currently the specification is not very clear on what this feature 
may do and does not define the transformation so implementations can 
presumably do what they want.


According to the draft, " Formatting the output by adding whitespace 
to produce a pretty-printed, indented, human-readable form. The exact 
form of the transformations is not specified by this specification. 
Setting this feature to true will set the feature "canonical-form" to 
false." Thus presumably anything other than adding white space is not 
allowed, though it would be nice for the spec to be more explicit 
about that.

One question: is it acceptable for an implementation to remove white 
space? or must it limit itself to adding white space?

As to DTD validity, I can't think of any cases where this would be 
affected purely by adding white space. DTDs just don't care which 
characters appear in text content, and white space is allowed between 
tags even where other characters are not.

For W3C XML schema language validity, you could potentially break 
validity if the schema used a regular expression to control the white 
white space. Alternately a perverse pretty printing algorithm that 
randomly inserted white space in the middle of non-white space 
characters could break schema validity. I don't think it's necessary 
to worry about this.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|           Processing XML with Java (Addison-Wesley, 2002)          |
|              http://www.cafeconleche.org/books/xmljava             |
| http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+

Received on Tuesday, 7 January 2003 10:14:47 UTC