In a Document Type Definition (DTD) an attributes type can be set to be CDATA.
The resulting attribute within an XML document may contain arbitrary character data.
So basically the DTD CDATA type is a string type with no restrictions placed on it, it can contain any textual data (as long as its suitably escaped).
Declaring a CDATA Attribute in a DTD |
Copy Code
|
---|---|
<!ATTLIST foo a CDATA #IMPLIED> |
Sample XML |
Copy Code
|
---|---|
<foo a="character data"/> <foo a="character data &"/> |
When an XML document is read in conjunction with a DTD only the standard attribute whitespace normalization rules are applied to an attribute value of type CDATA.
3.3.3 Attribute-Value Normalization
Before the value of an attribute is passed to the application or checked for validity, the XML processor MUST normalize the attribute value by applying the algorithm below, or by using some other method such that the value passed to the application is the same as that produced by the algorithm.
The CDATA DTD type should not be mistaken for the CDATA construct which may occur within an XML Document.