Previous | Table of Contents | Next |
Listing 12.2 shows a revision of the DTD from listing 12.1.
Listing 12.2 The Revised, Easy-to-Follow DTD
Notice the introductory and copyright information. Private DTDs could have company contacts and revision information.
<!-- (C) International Organization for Standardization 1986 Permission to copy in any form is granted for use with conforming SGML systems and applications as defined in ISO 8879, provided this notice is included in all copies. --> <!-- Public document type definition. Typical invocation: <!DOCTYPE general PUBLIC "ISO 8879:1986//DTD General Document//EN" [ <!ENTITY % ISOnum PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN"> <!ENTITY % ISOpub PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN"> %ISOnum; %ISOpub; (Parameter entities and additional elements can be defined here.) ]>
Good comment sections describe uses of document type. Note above describes additional extension that can be added.
--> <!ENTITY % doctype "general" -- Document type generic identifier --> <!-- This is a document type definition for a "general" document. It contains the necessary elements for use in many applications, and is organized so that other elements can be added in the document type declaration subset. --> <!-- Entity Naming Conventions --> <!-- Prefix = where used: p. = in paragraphs (also in phrases if .ph suffix) s. = in sections (i.e., among paragraphs) ps. = in paragraphs and sections i. = where allowed by inclusion exceptions m. = content model or declared content a. = attribute definition NONE= specific use defined in models Suffix = allowed content: .ph = elements whose content is %m.ph; .d = elements whose content has same definition NONE= elements with unique definitions -->
Notice like declarations are grouped together, explained, and aligned.
<!-- Element Tokens --> <!ENTITY % p.em.ph "hp1|hp2|hp3|hp0|cit" -- Emphasized phrases --> <!ENTITY % p.rf.ph "hdref|figref" -- Reference phrases --> <!ENTITY % p.rf.d "fnref|liref" -- References (empty) --> <!ENTITY % p.zz.ph "q|(%p.em.ph;)|(%p.rf.ph;)|(%p.rf.d;)" -- All phrases --> <!ENTITY % ps.ul.d "ol|sl|ul|nl" -- Unit-item lists --> <!ENTITY % ps.list "%ps.ul.d;|dl|gl" -- All lists --> <!ENTITY % ps.elem "xmp|lq|lines|tbl|address|artwork" -- Other elements --> <!ENTITY % ps.zz "(%ps.elem;)|(%ps.list;)" -- Para/sect subelements --> <!ENTITY % s.p.d "p|note" -- Simple paragraphs --> <!ENTITY % s.top "top1|top2|top3|top4" -- Topics --> <!ENTITY % s.zz "(%s.p.d;)|(%ps.zz;)|(%s.top;)" -- Section subelements --> <!ENTITY % i.float "fig|fn" -- Floating elements --> <!ENTITY % fm.d "abstract|preface" -- Front matter --> <!ENTITY % bm.d "glossary|bibliog" -- Back matter --> <!-- Model Groups --> <!ENTITY % m.ph "(#PCDATA|(%p.zz.ph;))*" -- Phrase model --> <!ENTITY % m.p "(#PCDATA|(%p.zz.ph;)|(%ps.zz;))*" -- Paragraph model --> <!ENTITY % m.pseq "(p, ((%s.p.d;)|(%ps.zz;))*)" -- Paragraph sequence --> <!ENTITY % m.top "(th?, p, (%s.zz;)*)" -- Topic model --> <!-- Document Structure --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT %doctype; - - (frontm?, body, appendix?, backm?) +(ix|%i.float;)> <!ELEMENT frontm - O (titlep, (%fm.d;|h1)*, toc?, figlist?)> <!ELEMENT body - O (h0+|h1+)> <!ELEMENT appendix - O (h1+)> <!ELEMENT backm - O ((%bm.d;|h1)*, index?)> <!ELEMENT (toc|figlist|index) -- Table of contents, figure list, -- - O EMPTY -- and index have generated content --> <!-- Title Page Elements --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT titlep - O (title & docnum? & date? & abstract? & (author|address|%s.zz;)*)> <!ELEMENT (docnum|date|author) - O (#PCDATA) -- Document number, etc. --> <!ELEMENT title - O (tline+) -- Document title --> <!ELEMENT tline O O %m.ph; -- Title line --> <!-- Headed Sections --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT h0 - O (h0t, (%s.zz;)*, h1+) -- Part --> <!ELEMENT (h1|%bm.d;|%fm.d;) - O (h1t, (%s.zz;)*, h2*) -- Chapter --> <!ELEMENT h2 - O (h2t, (%s.zz;)*, h3*) -- Section --> <!ELEMENT h3 - O (h3t, (%s.zz;)*, h4*) -- Subsection --> <!ELEMENT h4 - O (h4t, (%s.zz;)*) -- Sub-subsection --> <!ELEMENT (h0t|h1t|h2t|h3t|h4t) O O %m.ph; -- Headed section titles --> <!-- Topics (Captioned Subsections) --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT top1 - O %m.top; -(top1) -- Topic 1 --> <!ELEMENT top2 - O %m.top; -(top2) -- Topic 2 --> <!ELEMENT top3 - O %m.top; -(top3) -- Topic 3 --> <!ELEMENT top4 - O %m.top; -(top4) -- Topic 4 --> <!ELEMENT th - O %m.ph; -- Topic heading --> <!-- Elements in Sections or Paragraphs --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT address - - (aline+)> <!ELEMENT aline O O %m.ph; -- Address line --> <!ELEMENT artwork - O EMPTY> <!ELEMENT dl - - ((dthd+, ddhd)?, (dt+, dd)*)> <!ELEMENT dt - O %m.ph; -- Definition term --> <!ELEMENT (dthd|ddhd) - O (#PCDATA) -- Headings for dt and dd --> <!ELEMENT dd - O %m.pseq; -- Definition description --> <!ELEMENT gl - - (gt, (gd|gdg))* -- Glossary list --> <!ELEMENT gt - O (#PCDATA) -- Glossary term --> <!ELEMENT gdg - O (gd+) -- Glossary definition group --> <!ELEMENT gd - O %m.pseq; -- Glossary definition --> <!ELEMENT (%ps.ul.d;) - - (li*) -- Unit item lists --> <!ELEMENT li - O %m.pseq; -- List item --> <!ELEMENT lines O O %m.pseq; -- Line elements --> <!ELEMENT (lq|xmp) - - %m.pseq; -(%i.float;) -- Long quote --> <!ELEMENT (%s.p.d;) O O %m.p; -- Paragraphs --> <!-- Table --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT tbl - - (hr*, fr*, r+)> <!ELEMENT hr - O (h+) -- Heading row --> <!ELEMENT fr - O (f+) -- Footing row --> <!ELEMENT r O O (c+) -- Row (body of table) --> <!ELEMENT c O O %m.pseq; -- Cell in body row --> <!ELEMENT (f|h) O O (#PCDATA) -- Cell in fr or hr --> <!-- Phrases --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT (%p.em.ph;) - - %m.ph; -- Emphasized phrases --> <!ELEMENT q - - %m.ph; -- Quotation --> <!ELEMENT (%p.rf.ph;) - - %m.ph; -- Reference phrases --> <!ELEMENT (%p.rf.d;) - O EMPTY -- Generated references --> <!-- Includable Subelements --> <!-- ELEMENTS MIN CONTENT (EXCEPTIONS) --> <!ELEMENT fig - - (figbody, (figcap, figdesc?)?) -(%i.float;)> <!ELEMENT figbody O O %m.pseq; -- Figure body --> <!ELEMENT figcap - O %m.ph; -- Figure caption --> <!ELEMENT figdesc - O %m.pseq; -- Figure description --> <!ELEMENT fn - - %m.pseq; -(%i.float;) -- Footnote --> <!ELEMENT ix - O (#PCDATA) -- Index entry -->
Previous | Table of Contents | Next |