SAX2 RFD: LexicalHandler draft v.1.1

Ronald Bourret rbourret at
Wed Mar 24 17:32:22 GMT 1999

Bill la Forge wrote:

> From: Gavin Thomas Nicol <gtn at>
> >CDATA sections *are* different from normal text, even if only
> >because the author used them.
> Again, is anyone aware of why CDATA is preserved by the DOM?
> What was the reasoning behind this decision? Other things, like
> whitespace within an element tag or even attribute order, are not 
> Why then was CDATA?

I can't say why the DOM included CDATA, but I'll hazard a guess and agree 
with Gavin.  If I'm using a CDATA section, it means that I really, really, 
really don't want what's in the section to be parsed and it would be a 
royal pain for me if it was.  (Think about writing an HTML tutorial.)

The obvious place where preservation of CDATA is important, then, is when 
I'm co-authoring a document with a friend who uses a DOM-based editor while 
I prefer a text editor.  If every time my friend edits the document all the 
CDATA sections get wiped out, neither our friendship nor our co-authorship 
are going to last very long.

This is quite different from whitespace in element tags and attribute 
order, which are more aesthetic concerns than practical ones.  I might be a 
bit annoyed if my friends editor rearranges these, but I am unlikely to go 
looking for new partners because of it.

-- Ron Bourret

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at
Archived as: and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at

More information about the Xml-dev mailing list