The following is an example DTD (based on the SGML DTD that was used to produce this book), included to illustrate the concepts described in Chapters 5 and 10:
<!-- XML BOOK DTD DTD for The XML Companion AUTHOR: N.Bradley ([email protected]) VERSION: 1.4 (9/3/2001) --> <!-- ENTITY DECLARATIONS --> <!-- specify names and locations of external entities --> <!ENTITY % CALStable SYSTEM "TABLE.DTD"> <!ENTITY % ISOnum PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" SYSTEM "ISOnum.ent"> <!ENTITY % ISOlat1 PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN" SYSTEM "ISOlat1.ent"> <!ENTITY % ISOgrk1 PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN" SYSTEM "ISOgrk.ent"> <!ENTITY % ISOpub PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN" SYSTEM "ISOpub.ent"> <!-- merge-in the external entities --> %CALStable; %ISOnum; %ISOlat1; %ISOgrk1; %ISOpub; <!-- define internal entities --> <!ENTITY % Blocks "(para | markupPara | graphic | list | table | roadMap)*" > <!ENTITY % SuperSub "sup | sub" > <!ENTITY % Hilite "markup | emphStrong | emphWeak" > <!-- MAIN STRUCTURE --> <!-- Book document element --> <!ELEMENT book (front, body, back)> <!ATTLIST book id ID #REQUIRED> <!-- Title --> <!ELEMENT title (#PCDATA | %SuperSub;)*> <!-- FRONT SECTION --> <!-- front matter --> <!ELEMENT front (title, edition, author, publisher)> <!-- edition of book --> <!ELEMENT edition (#PCDATA)> <!-- author of book --> <!ELEMENT author (first, second, eMail?)> <!ELEMENT first (#PCDATA)> <!ELEMENT second (#PCDATA)> <!ELEMENT eMail (#PCDATA)> <!-- publisher of book --> <!ELEMENT publisher (pubName, address) <!ELEMENT pubName (#PCDATA)> <!ELEMENT address (#PCDATA)> <!-- BODY SECTION --> <!ELEMENT body (part+ | chapter+)> <!-- part (in body) --> <!ELEMENT part (title, chapter+)> <!-- chapter (in body or part) --> <!ELEMENT chapter (title, %Blocks;, section*)> <!ATTLIST chapter id ID #REQUIRED> <!-- section (in chapter) --> <!ELEMENT section (title, %Blocks;, subSection*)> <!ATTLIST section id ID #REQUIRED> <!-- subsection (in section) --> <!ELEMENT subSection (title, %Blocks;) <!ATTLIST subSection id ID #REQUIRED> <!-- roadmap charts have different pagination and font size rules --> <!ELEMENT roadMap (para | markupPara)*> <!-- BACK SECTION --> <!-- back matter --> <!ELEMENT back (glossary)> <!-- glossary (special form of chapter) --> <!ELEMENT glossary (para*, section*)> <!-- BLOCK STRUCTURES --> <!-- paragraph --> <!ELEMENT para (#PCDATA | %Hilite; | %SuperSub; | xRef)*> <!-- graphic image - placeholder --> <!ELEMENT graphic EMPTY> <!ATTLIST graphic id ID #IMPLIED ident ENTITY #REQUIRED> <!-- list --> <!ELEMENT list (item+)> <!-- list item --> <!ELEMENT item (#PCDATA | %Hilite; | %SuperSub; | xRef)*> <!ATTLIST item type (number|random) "random" <!-- text block dislayed in mono-space --> <!ELEMENT markupPara (markupLine*)> <!ATTLIST markupPara splitable (loose | together) "loose"> <!-- markup line - one line of text in markup fragment--> <!ELEMENT markupLine (#PCDATA | %Hilite; | %SuperSub; | presented)*> <!-- IN-LINE STRUCTURES --> <!-- example of rendered output --> <!ELEMENT presented (#PCDATA | %Hilite; | %SuperSub;)*)> <!-- XML example fragments in text --> <!ELEMENT markup (#PCDATA | %SuperSub; | emphStrong | emphWeak)*> <!-- emphasized text - shown in bold --> <!ELEMENT emphStrong (#PCDATA | markup | emphWeak | %SuperSub; | xRef)*> <!-- stressed (names) - shown in italic --> <!ELEMENT emphWeak (#PCDATA | markup | emphStrong | %SuperSub; | xRef)*> <!-- superscript --> <!ELEMENT sup (#PCDATA)> <!-- subscript --> <!ELEMENT sub (#PCDATA)> <!-- cross-references to other text in the book --> <!ELEMENT xRef (#PCDATA)> <!ATTLIST xRef source IDREF #REQUIRED> <!-- END END END -->
18.118.137.243