Attributes

To specify an attribute in a DTD, use the following syntax:

    <!ATTLIST element attribute_name attribute_type additional_characteristic>

In the syntax, !ATTLIST indicates the beginning of the attribute declaration and element represents the element name with which the attribute is associated. The attribute_name represents the name of the attribute and attribute_type represents the type of the attribute. The attribute_type can take the values shown in the following table.


Value

Description

CDATA

Represents character data with no markup. This is the default type.

ID

Specifies a unique value that cannot be repeated anywhere in the document.

NMTOKEN

Specifies a value that must conform to XML identifier name specifications.

(Value 1 | Value 2 |..| Value n)

Represents a list of permissible values.

The additional_characteristic can take the values shown in the following table.

Value

Description

default_value

Specifies that a default_value is used for the attribute when no other value is specified.

#FIXED ‘value

Specifies that only the value specified by 'value' can be used.

#REQUIRED

Specifies that the value for this attribute is mandatory and must be provided.

#IMPLIED

Represents an optional attribute with no default value.

Click the Next button to continue.