Example 3     <<      >>       intro       contents     

If an element name in DTD is followed by the star [*], this element can occur zero, once or several times.

  DTD   HOME     

The root element XXX can contain one or several elements AAA followed by precisely one element BBB. Element BBB must be always present.:

               <!ELEMENT XXX (AAA* , BBB)>
               <!ELEMENT AAA (#PCDATA)>
               <!ELEMENT BBB (#PCDATA)>
               
            


  Valid documents   HOME     

A valid document:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX> <AAA/> <BBB/> </XXX>
               
            

Another valid document. The element AAA is not mandatory.:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX> <BBB/> </XXX>
               
            

Several AAA elements can occur inside the document:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX> <AAA/> <AAA/> <AAA/> <AAA/> <AAA/> <AAA/> <AAA/> <BBB/> </XXX>
               
            

  Documents with errors   HOME     

Element BBB is missing:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX> ___ </XXX>
               
            

Element BBB must follow element AAA:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX> <BBB/> <AAA/> </XXX>
               
            

Element AAA must not follow element BBB:

               <!DOCTYPE tutorial SYSTEM "tutorial.dtd">

               <XXX> <AAA/> <AAA/> <AAA/> <AAA/> <BBB/> <AAA/> <AAA/> </XXX>