Previous Table of Contents Next


Separating the DTD into Logical Groups of Elements

Elements are declared in logical groups. Put elements in the groups where you best can maintain them and most easily keep track of them. A DTD typically has:

  Groups of elements that belong to the same type of document structure (such as paragraph elements, table elements, art elements, and embedded object elements).
  Groups of elements that are used in only one place (such as indexing elements, table of contents elements, bibliography elements, and equation elements).
  Groups of elements that are used in any place or every place (such as footnote elements, special symbol or character elements, and special entity declarations).
  Special processing elements that vary according to the circumstance (such as a call to a formatting DTD or a source that contains shared elements).

In most DTDs, the groups of elements follow these guidelines. If a DTD does not obey these guidelines exactly, it usually follows some of them and uses whatever organization is best for the application. In a mathematics application, for example, you might group elements according to the different types of equations or according to the different types of calculations involved.

Listing 12.4 shows another type of element group: processing instructions.


Caution:  
Processing instructions are normally machine-specific, so avoid putting them in your DTDs. They limit the usefulness of a DTD, but sometimes they are necessary.

Listing 12.4 A DTD with Logically Grouped Elements

 <!-- This is a Document Type Definition for newspapers
      with special consideration  of requirements for Persons
      with special needs to be presented in Braille,
      as large print editions or by artificial speakers -->

 <!-- This DTD was written by Manfred Kruger (MID Logistics
      Heidelberg, Germany) on the base of a paper written
      by Uli Strempel (SBA), entitled ‘Pre-final verbal
      description of the HAN-DTD-NP (EIF VER. 0.9)’, dated
      July 24, 1992, and on the DTD called BRL-2, written
      by Yuri Rubinsky (ICADD); not all concepts contained in this
      paper and the DTD are taken into consideration. It was
      furthermore discussed and elaborated by some members
      of the CAPS Consortium:

 - Uli Strempel (Stiftung Blindenanstalt, Germany)
 - Rolf Schmidt (Stiftung Blindenanstalt, Germany)
 - Pierre Bazex (Universit&eacute; Paul Sabatier, France)
 - Keith Gladstone (RNIB, Great Britain)
 - Henryk Rubinstein (Textalk, Sweden)
 - Bart Bauwens (Katholieke Universiteit Leuven, Belgium) -->

 <!-- Version 1.0
 Author: Manfred Kruger
 Started: October 17, 1992 (MK)
 Last Changes: May 18, 1993 (BB)

 Logfile of changes:
 * October 20, 1992: parameter entity %spndata; added (BB)
 * October 21, 1992: minimization type of end-tags of several
   elements were changed to ‘O’; further study of the
   minimization types may be necessary.
 * February 27, 1993:  first update; changed pictures
   and figures concept (BB)
 * May 18, 1993: added ICADD table (BB)
 -->

 <!-- Special needs data -->
 <!ENTITY % spndata     "(#PCDATA | abbr | unct |number)+"
 -- special needs data containing a mixture of abbreviations,
 uncontractable elements, numbers and PCDATA -->

 <!-- Parameter entities; following AAP -->
 <!ENTITY % i.float     "fig|picture|ipp"    -- floating elements -->
 <!ENTITY % p.em.ph     "it | b | bi | e1 | e2 | e3"  -- emphasis -->
 <!ENTITY % p.rf.ph     "xref"              -- internal crossrefs -->
 <!ENTITY % p.zz.ph     "q | emq | lang | (%p.em.ph;) | (%p.rf.ph;) |
                        sup | inf"
                         -- phrases -- >
 <!ENTITY % p.el        "ul"           -- unordered lists -->
 <!ENTITY % p.tbl       "table"           -- table matter -->
 <!ENTITY % p.zz        "%p.el; | %p.tbl;" -- paragraph subelements -->
 <!ENTITY % m.p         "(%spndata; | (%p.zz.ph;) | (%p.zz;))*"
                         -- paragraph text -->
 <!ENTITY % m.ph        "(%spndata; | (%p.zz.ph;))*" >
 <!ENTITY % para        "(p | cap | (continrf,continpt))+">

 <!-- Main structure for a newspaper -->

 <!ELEMENT capsnews - - (issue, (group|advert|newssect|newstbl|
                        picture|fig)+)

 -- It is assumed that a document instance of capsnews represents one
 edition of one newspaper. The newspaper may consist of a collection of
 article groups, advertisements, (short)news and pictures.
 They may occur in any order. M.K. -->

 <!-- Issue related information -->

 <!ELEMENT issue   - - (pinfo, npinfo, edinfo)

 -- The issue elements are taken from the MAJOUR-application
    as far as applicable for newspapers M.K. -->

 <!-- Publisher Information -->

 <!ELEMENT pinfo   - O  (pnm, loc*)+  >
 <!ELEMENT pnm     - O  %spndata;  -- name of the publisher-->
 <!ELEMENT loc     - O  (#PCDATA)  -- location -->

 <!-- Newspaper information -->

 <!ELEMENT npinfo  - O  (npid, nptl, npsbt?)>
 <!ELEMENT npid    - O  %spndata;  -- newspaper identifier -->
 <!ELEMENT nptl    - O  %spndata;  -- newspaper title -->
 <!ELEMENT npsbt   - O  %spndata;  -- newspaper subtitle -->

 <!-- Edition information -->

 <!ELEMENT edinfo  - O  (loc, yid, iid, cd)>
 <!ELEMENT yid     - O  (#PCDATA) -- year identifier -->
 <!ELEMENT iid     - O  (#PCDATA) -- issue identifier -->
 <!ELEMENT cd      - O  (#PCDATA) -- cover date -->

 <!-- Group structure -->

 <!ELEMENT group   - - (grtitle, (group | article)+)>

 <!-- Article structure -->

 <!ELEMENT article - - (kwd*, hdline?, atl, sbt?,  edloc?, artdate?,
                       source?, abs-p?,  au?, %para;, au?, source?)
                       +(%i.float;)>

 <!ELEMENT grtitle - O %spndata;  -- group title -->
 <!ELEMENT hdline  - O %m.ph; +(lb) -- this headline should be
                                       considered as a supertitle -->
 <!ELEMENT atl     - - %m.ph;  +(lb) -- article title -->
 <!ELEMENT sbt     - O %m.ph; +(lb) -- article subtitle -->
 <!ELEMENT au      - O %spndata; -- can include the text around
                                      the author’s name  M.K. -->
 <!ELEMENT edloc   - O %spndata;  -- editing location -->

 <!ELEMENT artdate - O (#PCDATA) -- article date -->

 <!ELEMENT source  - O %spndata; -- source (a news agency or
                                        the newspaper itself) -->
 <!ELEMENT abs-p   - O (%m.p;) -- highlighted paragraph,
                                  often used for summarizing or
                                  abstracting purposes -->
 <!ELEMENT p       - O (%m.p;) -- normal paragraph -->
 <!ELEMENT cap     - O %spndata;  +(lb)
 -- caption; used simply as some highlighted text between paragraphs-->
 <!ELEMENT continrf - O (#PCDATA) -- continuation reference;
 only necessary where the continuation of the article is separated -->

 <!ELEMENT continpt - O %spndata; -- continuation point;
                                   often repeating the article title
                                   in abbreviated form -->

 <!-- Following first level elements in capsnews are not
      yet examined. M.K.
  -->

 <!ELEMENT (advert|newssect|newstbl)
                   - -  CDATA -- has to be defined. M.K. -->

 <!-- Paragraph subelements; following AAP -->
 <!-- Phrases -->

 <!ELEMENT q       - - %m.ph;   -- (inline) quotation -->
 <!ELEMENT emq     - - %m.ph;  -- embedded quotation -->
 <!ELEMENT lang    - - (pht?,npht) -- foreign language text -->
 <!ELEMENT pht     - O (#PCDATA) -- phonetic transcription -->
 <!ELEMENT npht    - O %spndata; --nonphonetic part-->
 <!ELEMENT (%p.em.ph;) - - %m.ph;   -- all emphasizes -->
 <!ELEMENT (%p.rf.ph;) - - %m.ph; -- all crossrefs -->
 <!ELEMENT abbr    - - (#PCDATA) -- abbreviated term,
                                 to be spoken as letters -->
 <!ELEMENT unct    - - (#PCDATA) -- not contractable in Braille -->
 <!ELEMENT number  - - (#PCDATA) -- number which requires
                                       special formatting in Braille -->
 <!ELEMENT ipp     - - (#PCDATA) -- ink print page number -->
 <!ELEMENT (sup | inf) - - (#PCDATA) -- superscript and subscript -->

 <!-- Paragraph subelements -->
 <!ELEMENT ul      - - (lh?, li)* -- unordered list -->
 <!ELEMENT li      - - (p+) -- list item; simplified content model;
                                may be sufficient for newspaper articles.
                                M.K. -->
 <!ELEMENT lh      - - %m.ph; -- list header -->
 <!ELEMENT kwd     - O %spndata; -- keyword -->

 <!-- Tables: we refer to the ICADD table DTD:
      this DTD has also some provisions for the print disabled -->

 <!ENTITY % tables PUBLIC "-//EC-USA-CDA/ICADD
                           //DTD ICADD-4//EN" "ICADD.Tables">
 %tables;

 <!-- Figures: see declarations in DTP DTD -->

 <!ELEMENT fig     - - (gfc, fignum?, ti?, figdesc?, sfigdesc?) >

 <!ELEMENT (fignum |figdesc | sfigdesc)
                   - O %spndata;
                   -- figdesc gives a description of the figure,
                      sfigdesc gives a shorter description   -- >

 <!-- Pictures: similar to figures -->

 <!ELEMENT picture - - (gfc, ti?, figdesc?, by?)>
 <!ELEMENT by      - O %spndata; -- contains the source -->
 <!ELEMENT ti      - - %m.ph;    -- title -->

 <!ELEMENT gfc     - O EMPTY  -- notation attributes may be added -->
 <!ELEMENT lb      - O EMPTY>

 <!ENTITY invblk   "[invblk]" -- invisible blank -->

 <!-- public entities as per ISO/IEC TR 9573 -->

 <!ENTITY % ISOLAT1  PUBLIC "ISO 8879-1986//ENTITIES Added Latin 1//EN">
 %ISOLAT1;
 <!ENTITY % ISOLAT2  PUBLIC "ISO 8879-1986//ENTITIES Added Latin 2//EN">
 %ISOLAT2;
 <!ENTITY % ISOPUB   PUBLIC "ISO 8879-1986//ENTITIES Publishing//EN">
 %ISOPUB;

 <!-- Attribute definition lists -->

 <!ATTLIST capsnews  language  NAME       #REQUIRED
                   -- The name has to be given according to ISO 639 --
                   topics      NMTOKENS   #IMPLIED>

 <!ATTLIST  cd       year      NUMBER     #REQUIRED
                     month     NUMBER     #REQUIRED
                     day       NUMBER     #REQUIRED>

 <!ATTLIST edinfo    topics   NMTOKENS    #REQUIRED
                     -- The topics (sections) making up the edition
                        are listed here as attribute values.
                        Each article will have the theme name it
                        is belonging to.-->

 <!ATTLIST group     level   (1|2|3|4|5|6|7) #REQUIRED
                     grtitle  CDATA         #IMPLIED>

 <!ATTLIST article   language NAME          #IMPLIED -- only necessary
                        to be specified where the language of the article
                        differs from the language attribute value given
                        in capsnews --
                     topic    NMTOKEN       #IMPLIED
                     id       ID            #IMPLIED
                     page     NUTOKEN       #REQUIRED
                     pagepos  NUTOKEN       #IMPLIED
                     pgspused NUMBER        #IMPLIED
                     sizewrds NUMBER        #IMPLIED
                     noarch  (yes|no)       yes
                     boxed   (true|false)   false >

 <!ATTLIST hdline    pointsz NUMBER         #REQUIRED >

 <!ATTLIST atl       pointsz NUMBER         #REQUIRED
                     font    NMTOKEN        #REQUIRED
                     fstyle (regular|bold|italic|boldital)
                                            #REQUIRED>

 <!ATTLIST source    source (newsagcy | own) #IMPLIED >

 <!ATTLIST artdate   year    NUMBER         #IMPLIED
                     month   NUMBER         #IMPLIED
                     day     NUMBER         #IMPLIED>

 <!ATTLIST cap      pointsz  NUMBER         #REQUIRED
                    emph   (reg | it | b | bi | other)  reg
                    struct (section | inbetw) inbetw
   --may express sectioning or simply in-between titleing -->

 <!ATTLIST continrf rid      IDREF          #REQUIRED
                    page     NUTOKEN        #REQUIRED
                    pagepos  NUTOKEN        #REQUIRED>

 <!ATTLIST continpt id       ID             #REQUIRED>

 <!ATTLIST lang     lang     NAME           #REQUIRED >

 <!ATTLIST number kind (normal|tele|other) #IMPLIED >

 <!ATTLIST fig      id       ID            #IMPLIED
                    page     NUTOKEN       #REQUIRED
                    pagepos  NUTOKEN       #REQUIRED
                    pgspused NUMBER        #REQUIRED >

 <!ATTLIST (%p.rf.ph;) rid   IDREF         #IMPLIED>

 <!ATTLIST picture  id       ID            #IMPLIED
                    page     NUTOKEN       #REQUIRED
                    pagepos  NUTOKEN       #REQUIRED
                    pgspused NUMBER        #REQUIRED>

 <!ATTLIST gfc      id       ID            #IMPLIED
                    sizex    NUTOKEN       #IMPLIED
                    sizey    NUTOKEN       #IMPLIED
                    unit     CDATA         #IMPLIED>


Previous Table of Contents Next