Re: The phrase: Node created by Document needs clarification

normalize() will merge adjacent text nodes. It will _NOT_ discard
whitespace, though it may merge the whitespace with adjacent text if there
was any. (Of course, a parser normally delivers a document in normalize()d
form anyway...)

>Is the user's job to preserve whitespaces (e.g) for correct output when
>using DOM implementations?

Whitespace is officially part of the document's content, per the XML spec.
The DOM preserves it. If you filter it out of the document before building
the DOM, there's nothing we can do about it. Similarly, if your serializer
introduces additional whitespace, there's nothing we can do about that.
Either has the potential to change the document's meaning and shoudl be
done only when you _KNOW_ that the whitespace is not meaningful.

But that's really an XML processing issue, not a DOM issue.

Joe Kesselman  / IBM Research

Received on Thursday, 30 August 2001 12:55:29 UTC