In the DTD, you declare lists of attributes in a manner similar to how you declare elements--by means of an attribute-list declaration.
The MouseOver shows the generic syntax for declaring an attribute, an attribute-list declaration, and an example of attribute usage.
Note the composition of the ID value in the XML file as required by its type:
Attribute syntax and usage
Attribute types
The table below contains the most commonly-used attribute types.
An IDREF holds the ID value of another element in the document. It is used to explore any relationships that may exit between different elements in an XML document.
For any attribute-list declaration, only one attribute can be specified as type ID.
Attribute Type
Description
CDATA
Can contain any kind of character data.
ID
Must have unique values within the element. For example, if you have three BOOK elements, and each has an ID attribute, the value of each ID type attribute within book elements must be unique. In the following example, TYPEID is of the ID type, and as such, requires unique values within the range of BOOK elements:
<BOOK TYPEID="ch1">See Spot Run</BOOK>
<BOOK TYPEID="ch2">Jack and Jill</BOOK>
(enumerated)
Specifies a default value if none was declared. Attributes can be defined to carry a list of accepted values. For example, in HTML, the ALIGN attribute can accept three values: left, center, and right. In the case of ALIGN with an enumerated list, left is the default value when none is specified.