Example 11     <<      >>       intro       contents     

The value of an attribute of ID type can contain only characters permitted for NMTOKEN and must start with a letter. No element type may have more than one ID attribute specified. The value of an ID attribute must be unique between all values of all ID attributes.

  DTD   HOME     

The attributes id, code and X uniquely determine their element:

               <!ELEMENT XXX (AAA+ , BBB+ , CCC+)>
               <!ELEMENT AAA (#PCDATA)>
               <!ELEMENT BBB (#PCDATA)>
               <!ELEMENT CCC (#PCDATA)>
               <!ATTLIST AAA 
                         id ID #REQUIRED>
               <!ATTLIST BBB 
                         code ID #IMPLIED
                         list NMTOKEN #IMPLIED>          
               <!ATTLIST CCC 
                         X ID #REQUIRED
                         Y NMTOKEN #IMPLIED>
               
            


  Valid documents   HOME     

All ID values are unique :

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA id="a1"/>
                    <AAA id="a2"/>
                    <AAA id="a3"/>
                    <BBB code="QWQ-123-14-6" list="14:5"/>
                    <CCC X="zero" Y="16" />
               </XXX>
               
            

The attributes list and Y are of type NMTOKEN not ID. They can have therefore the same value as ID attributes or to have the same value in several elements :

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA id="L12"/>
                    <BBB code="QW" list="L12"/>
                    <CCC X="x-0" Y="QW" />
                    <CCC X="x-1" Y="QW" />
               </XXX>
               
            

  Documents with errors   HOME     

The ID attribute must not start with a number or contain a character not permitted in NMTOKEN:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA id="L12"/>
                    <BBB code="#QW" list="L12"/>
                    <CCC X="12" Y="QW" />
               </XXX>
               
            

The ID attribute must have a unique value:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA id="L12"/>
                    <BBB code="QW" list="L12"/>
                    <CCC X="ZA" Y="QW" />
                    <CCC X="ZA" Y="QW" />
               </XXX>
               
            

The ID attribute must have a unique value. Both id and X are of type ID:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA id="L12"/>
                    <BBB code="QW" list="L12"/>
                    <CCC X="L12" Y="QW" />
               </XXX>