CDATA sections in mixed content

The XML test suite contains several examples of valid test files which
contain CDATA sections in mixed content elements.  An example is the
test file of ID "valid-sa-18":

<!DOCTYPE doc [
<!ELEMENT doc (#PCDATA)>
]>
<doc><![CDATA[<foo>]]></doc>

However, according to my understanding of the XML 1.0, 3rd ed. spec,
this is not a valid XML document, because:

1. Sec. 2.4 defines CDATA section delimiters as markup, while the
definition of character data is: "All text that is not markup
constitutes the character data of the document.".
2. Sec. 3.2.2 "Mixed Content" states: "An element type has mixed
content when elements of that type MAY contain character data,
optionally interspersed with child elements."

Since according to (1) CDATA section delimiters are not character data
and according to (2) only character data or child elements are allowed
in mixed content, it follows that CDATA sections are not allowed in
mixed content.

Ergo, either the XML spec needs to be corrected here or it is a bug in
the XML test suite.

Dr. Dieter  Köhler

Institute of Philosophy
University of Karlsruhe
Germany

Received on Tuesday, 14 September 2004 08:47:34 UTC