W3C home > Mailing lists > Public > www-dom@w3.org > January to March 1999

"Empty" Text Nodes

From: Oliver Becker <obecker@informatik.hu-berlin.de>
Date: Wed, 24 Feb 1999 16:57:26 +0100 (MET)
Message-Id: <199902241557.QAA02906@mail.informatik.hu-berlin.de>
To: www-dom@w3.org
Hi there,

I am completely new to DOM. While experiencing with IBM's xml4j a
general question arose.

Am I right in assuming that the structure model of a XML document
created by a non-validating DOM implementation should be isomorph
to that created by a validating one?
(With exceptions regarding DocumentType of course, default values
of attributes, entities ...)

But if I have the TABLE example on page 10 of the printed DOM 1.0
specification then the structure should be like the one presented
on page 11.

The question is: what happens to white spaces like newlines?
According to a DTD I can decide to ignore them.
But if I consider an element like PRE in HTML then newlines and spaces
are important, and should be accessible via a Text node.

In fact xml4j creates with its (validating) DOMParser a structure like

Element TABLE
   Text "\n"
   Element TBODY
      Text "\n"
      Element TR
         ...
      Text "\n"
      Element TR
         ...
      Text "\n"
   Text "\n"
   
My first opinion was that those Text nodes "\n" are unnecessary.
But after thinking it over I am a little bit in doubt ...

Any comments?

Regards,
Oliver

/-------------------------------------------------------------------\
|  ob|do        Dipl.Inf. Oliver Becker                             |
|  --+--        E-Mail: obecker@informatik.hu-berlin.de             |
|  op|qo        WWW:    http://www.informatik.hu-berlin.de/~obecker |
\-------------------------------------------------------------------/
Received on Wednesday, 24 February 1999 10:57:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:46 GMT