Declaring Attributes

Attributes are a mechanism with which you can provide further information about an element. You declare the attributes for an element in a DTD after declaring the element. The attribute declaration is of the following form:

<!ATTLIST element_name attribute_definition>

where attribute_definition takes the following form:

						attribute_name attribute_type [default_declaration]

The attribute definition provides the following information:

  • The name of the attribute

  • The type of the attribute

  • Default value for the attribute, or whether the attribute is required

Attribute Name

The name of the attribute is self-explanatory. Attribute names can be anything as long as they follow the naming rules that were described in the element declaration ...

Get Java™ APIs for XML Kick Start now with O’Reilly online learning.

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