Liquid Technologies - XML Glossary
DTD / Data Types / DTD CDATA
In This Topic
    In This Topic

    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
    Sample XML
    Copy Code
    <foo a="character data"/>
    <foo a="character data &amp;"/>


    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.

    1. All line breaks MUST have been normalized on input to #xA as described in 2.11 End-of-Line Handling, so the rest of this algorithm operates on text normalized in this way.
    2. Begin with a normalized value consisting of the empty string.
    3. For each character, entity reference, or character reference in the unnormalized attribute value, beginning with the first and continuing to the last, do the following:
      • For a character reference, append the referenced character to the normalized value.
      • For an entity reference, recursively apply step 3 of this algorithm to the replacement text of the entity.
      • For a white space character (#x20, #xD, #xA, #x9), append a space character (#x20) to the normalized value.
      • For another character, append the character to the normalized value.

    The CDATA DTD type should not be mistaken for the CDATA construct which may occur within an XML Document.

    See Also