Previous Table of Contents Next


Notice now all elements are grouped by function and usage. Attribute models come right after the applicable element declaration.

 <!--        Table Elements                        -->

 <!ELEMENT table    - - (title,((tgroup+,tnote?)|graphic))>
 <!ATTLIST table       %stanat;
           label        CDATA        #IMPLIED>
 <!ELEMENT tgroup   - - (colspec*,spanspec*,thead?,tobody)>
 <!ATTLIST tgroup       cols      NUMBER              #REQUIRED>
 <!ELEMENT colspec  - - EMPTY>
 <!ATTLIST colspec      colnum    NUMBER              #REQUIRED
                        colname   NMTOKEN             #IMPLIED
                        align     (left|right|center))#IMPLIED
                        colwidth  CDATA               #IMPLIED>
 <!ELEMENT spanspec - - EMPTY>
 <!ATTLIST spanspec  namest       NMTOKEN             #REQUIRED
                     nameend      NMTOKEN             #REQUIRED
                     spanname     CDATA               #REQUIRED
                     align        (left|right|center)) "center">
 <!ELEMENT thead    - - (row+)>
 <!ELEMENT tbody    - - (row+)>
 <!ELEMENT row      - - (entry+)>
 <!ATTLIST row          %stanat;>
 <!ELEMENT entry    - - (txtentry|strentry)>
 <!ATTLIST entry    colname       NMTOKEN             #IMPLIED
                    spanname      CDATA               #IMPLIED
                    wrap          (n)                 #IMPLIED
                    align         (left|right|center) #IMPLIED
                    %stanat;>
 <!ELEMENT txtentry o o %data;>
 <!ELEMENT strentry o o (para|nlist|blist|note|caut|warn|txteqn|stdeqn)+>
 <!ELEMENT tnote    - - (para+)>
 <!ATTLIST tnote    %stanat;>

 <!ELEMENT illus    - - (title?,graphic,keylst?)>
 <!ATTLIST illus   %stanat;
                   label          CDATA              #REQUIRED>
 <!ELEMENT graphic  - o EMPTY>
 <!ATTLIST graphic filename       CDATA              #REQUIRED
                   artno          CDATA              #IMPLIED>
 <!ELEMENT keylst   - - (title,tgroup)>
 <!ATTLIST keylst  %stanat;>
 <!ELEMENT scand  - o EMPTY>
 <!ATTLIST scand filename         CDATA              #REQUIRED>
 <!ELEMENT note     - - (para+)>
 <!ATTLIST note    %stanat;>
 <!ELEMENT caut    - - (para+)>
 <!ELEMENT caut    %stanat;>
 <!ELEMENT warn    - - (para+)>
 <!ATTLIST warn    %stanat;>

 <!--      Data Elements           -->

 <!ELEMENT  emph     - - (#PCDATA|xref|emph)+>
 <!ATTLIIST emph     type (sup|sub|ul|bold|supul|supbold|supboul
                        |subul|subbold|subboul|boldul)  #REQUIRED>
 <!ELEMENT  rdi   - - (#PCDATA)>
 <!ATTLIST  rdi   %stanat;>
 <!ELEMENT  partno   - - (#PCDATA)>
 <!ATTLIST  partno   %stanat;>
 <!ELEMENT  partname - - (#PCDATA)>
 <!ATTLIST  partname %stanat;>
 <!ELEMENT  manufact - - (#PCDATA)>
 <!ATTLIST  manufact %stanat;>
 <!ELEMENT  product  - - (#PCDATA)>
 <!ATTLIST  product  %stanat;>

 <!--   References  -->

 <!ELEMENT  xref     - - (%minmum;)+>
 <!ATTLIST  xref  idref  CDATA   #REQUIRED>
 <!ELEMENT  eref     - - (%minmum;)+>
 <!ATTLIST  eref  book   CDATA   #REQUIRED
                  idref  CDATA   #REQUIRED>
 <!ELEMENT  appref   - - (%minmum;)+>
 <!ATTLIST  appref applic CDATA  #REQUIRED
                   args   CDATA  #REQUIRED>

 <!--    Character Entities      -->

 <!ENTITY % ISOpub
            PUBLIC "ISO 8879-1986//ENTITIES Publishing//EN">
 <!ENTITY % ISOnum
            PUBLIC "ISO 8879-1986//ENTITIES Numeric and Special
            Graphics//EN">
 <!ENTITY % ISOgrk3
            PUBLIC "ISO 8879-1986//ENTITIES Greek Symbols//EN">

%ISOpub;%ISOnum;%ISOgrk3;

Notice several things about this common DTD:

  It has an abundance of comments, including a revision history, authors, and a change history.
  Clearly divided partitions describe the elements that they contain.
  The order of the list of elements parallels the order of the content model. For example, if the content model includes (para|txteqn|stdeqn)+, the elements para, txteqn, and stdeqn are defined in the same order—unless they have already been defined.

Since the common DTD makes references to and from other DTDs, you need to format your DTD so those references appear clearly.

Making Comments in DTDs

You have seen this before, but it bears repeating. The first thing that you see in a good DTD is a list of comment lines. Look at listing 12.3. You can learn much about the document just from the first few lines of comments. Comments throughout the document help, too. Comments are the lines that resemble the one below:

 <!--        Table Elements                        -->

Notice the <!-- at the beginning of the line and the --> at the end of the line. These are opening and closing delimiters for comments.

Make comments whenever you want to:

  Identify groups of elements
  Make the order of the DTD more obvious
  Describe anything out of the ordinary
  Explain the history behind an unusual decision

You can make two types of comments in a DTD: full comment declarations and inline comments.


Previous Table of Contents Next