Example 12     <<      >>       intro       contents     

The value of IDREF attribute must match the value of some ID attribute in the document. The value of IDREFS attribute can contain several references to elements with ID attribute separated with whitespaces.

  DTD   HOME     

The attributes id and mark uniquely determine their element. The attributes ref reffer to these elements:

               <!ELEMENT XXX (AAA+ , BBB+, CCC+, DDD+)>
               <!ELEMENT AAA (#PCDATA)>
               <!ELEMENT BBB (#PCDATA)>
               <!ELEMENT CCC (#PCDATA)>
               <!ELEMENT DDD (#PCDATA)>
               <!ATTLIST AAA 
                         mark ID #REQUIRED>
               <!ATTLIST BBB 
                         id ID #REQUIRED>          
               <!ATTLIST CCC 
                         ref IDREF #REQUIRED>
               <!ATTLIST DDD 
                         ref IDREFS #REQUIRED>          
               
            


  Valid documents   HOME     

All ID values are unique and all IDREF and IDREFS point to elements with relevant IDs:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA mark="a1"/>
                    <AAA mark="a2"/>
                    <AAA mark="a3"/>
                    <BBB id="b001" />
                    <CCC ref="a3" />
                    <DDD ref="a1 b001 a2" />
               </XXX>
               
            

  Documents with errors   HOME     

There are no ID attributes with value a3 or b001:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA mark="a1"/>
                    <AAA mark="a2"/>     
                    <BBB id="b01" />
                    <CCC ref="a3" />
                    <DDD ref="a1 b001 a2" />
               </XXX>
               
            

The attribute ref in element CCC is of type IDREF. It can contain only one reference:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX>
                    <AAA mark="a1"/>
                    <AAA mark="a2"/>
                    <AAA mark="a3"/>
                    <BBB id="b001" />
                    <CCC ref="a1 b001 a2" />
                    <DDD ref="a1 b001 a2" />
               </XXX>