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)
Type | Description |
---|---|
CDATA | Character Data (text that doesn't contain markup) |
ENTITY | The name of an entity (which must be declared in the DTD) |
ENTITIES | A list of entity names, separated by whitespaces. (All entities must be declared in the DTD) |
Enumerated | A list of values. The value of the attribute must be one from this list. |
ID | A unique ID or name. Must be a valid XML name. |
IDREF | Represents the value of an ID attribute of another element. |
IDREFS | Represents multiple IDs of elements, separated by whitespace. |
NMTOKEN | A valid XML name. |
NMTOKENS | A list of valid XML names, separated by whitespace. |
NOTATION | A notation name (which must be declared in the DTD). |