More Complex Example of Aggregating Modifiers in DTDs

Following is a more complicated example. Suppose you want book elements to include

  • Exactly one title
  • Either an author or an editor, but it is okay if neither appear
  • Zero or more paragraphs

To accomplish this, you would perform steps that generate the following tree representation:

book
               

              
Sequence
                   
title
                   
Optional
                   
	Choice
                   
		author
                   
		editor
                   
Zero or More
                   
	paragraph
                   

                

In the Text view of the DTD, the definition for the book element is as follows:

<!ELEMENT book (title, (author|editor)?, paragraph*)>
               

            

 
Free Stylus Studio XML Training: