Example 13     <<      >>       intro       contents     

Permitted attribute values can be defined in DTD.

  DTD   HOME     

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 documents   HOME     

All values are given in DTD:

               <!DOCTYPE tutorial 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 errors   HOME     

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

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

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