Simple Example of Aggregating Modifiers in DTDs

Suppose you want a book element to always contain exactly one title element and any number of author elements. The title and author elements contain only raw data. To accomplish this, you would perform steps that generate the following tree representation:

book
               

              
Sequence
                   
title
                   
One or More
                   

                
author title
Zero or More
                   
#PCDATA
                   

                
author
Zero or More
                   
#PCDATA
                   

                

In the book element definition, Sequence modifies book and One or More modifies Sequence. Because the title element immediately follows the Sequence modifier, the default occurrence rule is assumed. That is, the title element must appear exactly once. In the Text view of the DTD, the definition for the book element is as follows:

<!ELEMENT book (title, (author)+)>
       

    
 
Free Stylus Studio XML Training: