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*)>
               

            

DTD vs. Schema

Stylus Studio provides tools for working with both W3C XML Schema and DTD's - this tutorial explains what the differences are between the two, providing a technical comparison of DTD vs Schema.

XQuery Profiler

Stylus Studio's XQuery Profiler allows you to benchmark any XQuery expression, and it helps you locate and eliminate performance bottlenecks for maximum XQuery performance.

XML Parser

An XML Parser is a parser that is designed to read XML and create a way for programs to use XML. Learn about Stylus Studio's comprehensive support for all of the world's leading XML Parsers.

XHTML Tools

Powerful XHTML Tools for converting HTML to XHTML, validating XHTML, transforming XML to XHTML, editing JSP, creating XML driven Websites and more.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member