DTD Attribute Types

An overview of the DTD attribute types.

So far, all our examples for declaring attributes have used the CDATA attribute type. CDATA is probably the most common attribute type as it allows for plain text to be used for the attribute's value. There may however, be cases where you need to use a different attribute type.

When setting attributes for your elements, the attribute TYPE field can be set to one of the following values:

(Clicking on each type leads to a more detailed explanation of that type)

TypeDescription
CDATACharacter Data (text that doesn't contain markup)
ENTITYThe name of an entity (which must be declared in the DTD)
ENTITIESA list of entity names, separated by whitespaces. (All entities must be declared in the DTD)
EnumeratedA list of values. The value of the attribute must be one from this list.
IDA unique ID or name. Must be a valid XML name.
IDREFRepresents the value of an ID attribute of another element.
IDREFSRepresents multiple IDs of elements, separated by whitespace.
NMTOKENA valid XML name.
NMTOKENSA list of valid XML names, separated by whitespace.
NOTATIONA notation name (which must be declared in the DTD).