More CDATA questions

roddey at roddey at
Wed Jun 16 23:41:17 BST 1999

This has probably been dealt with somewhere else, but I don't remember it right
off hand so I'll ask at the possibility of being redundant... Glenn brought this
up and we didn't have any really feeling for the answer (other than what we

Is CDATA effectively the same as an entity reference except that its in place?
I.e. is it basically just a blob of text which, once seen will have the
bracketting gorp removed and the characters will be taken as character data of
the enclosing element?

Part of the reason for this question is to straighten out a possible ambiguity
in our parsers. We have an ignorable whitespace callback and a characters
callback on the document handler. Each of them has an 'isCDATA' parameter that
indicates whether the chars/ws being passed out in the event came from a CDATA
section or not.

So, if I see this:

   <![CDATA[     ]]>

should the spaces inside the CDATA be treated as either ignorable whitespace or
characters according to the normal processing rules for a CHILDREN element? Or
is there any way in which the content of the CDATA section would be treated
differently? Would, for instance, it always be considered characters because its
not just 'accidental whitespace'? Its obviously not just whitespace that happens
to be in the content of the element, it was purposefully put into the element
content to be treated 'as is'. OTOH, this would be technically illegal if it
were treated as anything besides ignorable whitespace because the content model

I guess part of the question is that are the contents of CDATA sections REALLY
not passed judgement on, as you would think from the spec, or are they just KIND
OF NOT REALLY passed judgement on? If you really just take the CDATA content as
is, then you really shouldn't have to find out if they are all whitespace and
deal with the validity issues of the content model. But, if you don't, then they
could put non-ws characters in the content model of something that had CHILDREN
or MIXED models.

Am I making any sense here? :-)

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