DTD Attribute Default Values
In the previous lesson, we defined an attribute using a default value of No. In this lesson, we look at the various options for defining default values for your attributes.
Default Values
The attribute TYPE field can be set to one of the following values:
| Value | Description |
|---|---|
| value | A simple text value, enclosed in quotes. |
| #IMPLIED | Specifies that there is no default value for this attribute, and that the attribute is optional. |
| #REQUIRED | There is no default value for this attribute, but a a value must be assigned. |
| #FIXED value | The #FIXED part specifies that the value must be the value provided. The value part represents the actual value. |
Examples of these default values follow.
value
You can provide an actual value to be the default value by placing it in quotes.
Syntax:
Example:
#REQUIRED
The #REQUIRED keyword specifies that you won't be providing a default value, but that you require that anyone using this DTD does provide one.
Syntax:
Example:
#IMPLIED
The #IMPLIED keyword specifies that you won't be providing a default value, and that the attribute is optional for users of this DTD.
Syntax:
Example:
#FIXED
The #FIXED keyword specifies that you will provide value, and that's the only value that can be used by users of this DTD.
Syntax:
Example: