DTD Attribute Types - Enumerated
The enumerated attribute type provides for a list of possible values. This enables the DTD user to provide one value from the list of possible values.
The values must be surrounded by parentheses, and each value must be separated by a pipe (|).
Syntax:
<!ATTLIST element_name
attribute_name (value1 | value2 | value3) default_value>
Example:
<!ATTLIST tutorial
published (yes | no) "no">
Valid XML - The following XML document would be valid, as it conforms to the above DTD:
<tutorials>
<tutorial published="yes">
<name>XML Tutorial</name>
</tutorial>
<tutorial published="no">
<name>HTML Tutorial</name>
</tutorial>
<tutorial>
<name>CSS Tutorial</name>
</tutorial>
</tutorials>
Invalid XML - The following XML document would be invalid because the value of the first attribute does not match one of the options of the ATTLIST declaration:
<tutorials>
<tutorial published="true">
<name>XML Tutorial</name>
</tutorial>
<tutorial published="no">
<name>HTML Tutorial</name>
</tutorial>
<tutorial>
<name>CSS Tutorial</name>
</tutorial>
</tutorials>
