If you use the #REQUIRED keyword, the associated
attribute must always be provided when the element is used in a
document. Within the XHTML DTD, the src attribute
of the <img> tag is required, since an image
tag makes no sense without an image to display.
The #IMPLIED keyword means that the attribute may
be used but is not required and that no default value is associated
with the attribute. If it is not supplied by the document author, the
attribute will have no value when the XML processor handles the
element. For the <img> tag, the
width and height attributes are
implied, since the browser will derive sizing information from the
image itself if these attributes are not specified.
If you specify a value, it then becomes the default value for that
attribute. If a value for the attribute is not specified by the user,
the XML processor will insert the default value (the value specified
in the DTD).
If you precede the default value with the keyword
#FIXED, the value is not only the default value
for the attribute, it is the only value that can
be used with that attribute, if it is specified.
For example, examine the attribute list for the
form element, taken (and abridged) from the HTML
DTD:
<!ATTLIST form
action CDATA #REQUIRED
method (get|post) "get"
enctype CDATA "application/x-www-form-urlencoded"
onsubmit CDATA #IMPLIED
onreset CDATA #IMPLIED
accept CDATA #IMPLIED
accept-charset CDATA #IMPLIED
>
This example associates seven attributes with the
form element. The action
attribute is required and accepts a character string value. The
method attribute has one of two values, either
get or post.
get is the default, so if the document author
doesn't include the method attribute in the
form tag, method=get will be assumed automatically
by the XML parser.
The enctype attribute for the
form element accepts a character string value and
if not specified, defaults to a value of
application/x-www-form-urlencoded. The remaining
attributes all accept character strings, are not required, and have
no default value if they are not specified.