Declaring Attributes

Just as the element declaration limits the contents of a particular element, the attribute declaration controls which and what type of attributes can be included in a particular element.

The <!ATTLIST> markup tag is used to control the attributes that can be included in a particular element. As an example, here's the attribute declaration for the item element:

<!ATTLIST item
  id  ID    #IMPLIED
  ref IDREF #IMPLIED
>

The first name token after the <!ATTLIST> markup is the name of the element associated with this declaration. Following the element name is a list of attribute name, type, and default-value triples. Multiple <!ATTLIST> declarations can be given for a single element throughout the DTD. The result is the same as if ...

Get Strategic XML now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.