XML Schemas: DTD Example

Original Author(s): Markus Gylling

Example of DTD syntax



 <!ELEMENT book (title, chapter+)>
 <!ELEMENT chapter (heading, paragraph*)>
 <!ELEMENT heading (#PCDATA)>
 <!ELEMENT paragraph (#PCDATA)>
 <!ATTLIST book
     language CDATA #REQUIRED
     author CDATA #REQUIRED
 >

Corresponds to the following XML document:


<book language="en" author="Ernest Hemingway">
 <title>A Farewell to Arms</title>
 <chapter>
   <heading>Chapter One</heading>
   <paragraph> ... <paragraph>
   <paragraph> ... <paragraph>
 </chapter>
 <chapter>
   <heading>Chapter Two</heading>
   <paragraph> ... <paragraph>
   <paragraph> ... <paragraph>
 </chapter>
</book>

Read More

DAISYpedia Categories: 


This page was last edited by Content Manager on Friday, August 20, 2010 16:55
Text is available under the terms of the DAISY Consortium Intellectual Property Policy, Licensing, and Working Group Process.