>> English << | česky | Español | По-русски | Français | Italiano | Deutsch | MagyarZVON > Tutorials > DTD Tutorial
>> Example 13 << | Prev | Next | Contents

Description

Permitted attribute values can be defined in DTD.

DTD


This DTD precisely states permitted values:

<!ELEMENT XXX (AAA+, BBB+)>
<!ELEMENT AAA (#PCDATA)>
<!ELEMENT BBB (#PCDATA)>
<!ATTLIST AAA 
         true ( yes | no ) #REQUIRED>
<!ATTLIST BBB 
   month (1|2|3|4|5|6|7|8|9|10|11|12) #IMPLIED>      
   

Valid documentsTop


All values are given in DTD:

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
   <AAA true="yes"/>
   <AAA true="no"/>
   <AAA true="yes"/>
   <BBB month="8" />
   <BBB month="2" />
   <BBB month="12" />
</XXX>

Documents with errorsTop


The attribute true cannot have the value "maybe", the attribute month cannot have the value "16" :

 <!DOCTYPE XXX SYSTEM "tutorial.dtd">

<XXX>
   <AAA true="yes"/>
   <AAA true="no"/>
   <AAA true="maybe"/>
   <BBB month="8" />
   <BBB month="2" />
   <BBB month="16" />
</XXX>