Part III. DTD Development

Table of Contents

8. Markup Model Design and Implementation
8.1. Determining the Number of DTDs
8.1.1. Creating DTDs for Nested Document Types
8.1.2. Creating Variant Element and Attribute Declarations
8.2. Interpreting and Handling Element Content Model Specifications
8.2.1. Handling Specifications That Specify Ambiguous Content Models
8.2.2. Forcing the Occurrence of One of Several Optional Elements
8.2.3. Limiting the Occurrence of Any-Order Elements
8.2.4. Handling Specifications for Mixed Content
8.3. Handling Specifications for Attributes
8.3.1. Designing Enumerated-Type Attributes
8.3.2. Designing ID and ID Reference Attributes
8.3.3. Designing Attributes with Implied Values
8.4. Useful Markup to Consider
8.4.1. Semantic Extension Markup
8.4.2. Markup That Eases Document Conversion
8.5. Designing Markup Names
8.6. Designing Markup Minimization
8.7. Addressing Other Factors in Markup Design
8.7.1. Allowing Markup Characters as Document Content
8.7.2. Defining Entities for Special Symbols and Characters
8.7.3. Creating Text Databases and Templates
8.7.4. Supplying a Default Entity Declaration
9. Techniques for DTD Maintenance and Readability
9.1. Using Good Coding Style
9.1.1. Comment Style
9.1.2. White Space Style
9.2. Organizing Element and Attribute Declarations
9.3. Managing Parameter Entities for Element Collections
9.4. Synchronizing the Content Models and Attributes of Multiple Elements
9.5. Creating New Attribute Keywords
10. Techniques for DTD Reuse and Customization
10.1. Categories of Customization
10.1.1. Subsetted Markup Models
10.1.2. Extended Markup Models
10.1.3. Renamed Markup Models
10.2. Facilitating Customization
10.2.1. Making DTDs Modular
10.2.2. Making Content Models Customizable
10.2.3. Including Markup Declarations Conditionally
10.2.4. Making Markup Names Customizable
10.3. Customizing Existing DTDs
11. Validation and Testing
11.1. Setting Up and Managing a Bug-Reporting System
11.2. Validating the DTD
11.3. Validating the Markup Model
11.3.1. Wrong or Overly Constrained Model
11.3.2. Overly Broad Model
11.4. Testing the Use of the DTD in the Real World
11.4.1. Usability with Applications
11.4.2. Usability with People

This part is intended for DTD implementors. With the completed document analysis report and other project documents in hand, you implement the DTD and the SGML declaration by doing the following:

  • Designing the markup model for the document type and implementing it in SGML form. This work mainly involves designing and creating the element and attribute declarations. Chapter 8, Markup Model Design and Implementation describes some of these design considerations.

  • Using good technique for maintenance and readability. This work mainly involves the artful use of parameter entities and comments. Chapter 9, Techniques for DTD Maintenance and Readability describes some useful techniques.

  • Constructing the DTD to allow parts of it to be reused and customized. This work involves breaking up the DTD into modular files and using parameter entities and marked sections. Chapter 10, Techniques for DTD Reuse and Customization shows how to do this work and describes considerations for customizing an existing DTD.

  • Validating and testing the DTD. This work involves checking your DTD implementation with a validating parser and testing the markup model for effectiveness on real documents. Chapter 11, Validation and Testing describes some common DTD validation problems and solutions and discusses testing strategies.

These topics aren't separate sequential stages of DTD implementation; they're just different techniques that solve different problems. You're likely to move back and forth among them, especially as you gain experience. Careful planning in each area helps you avoid making “design at the keyboard” implementation decisions that are based on expediency rather than on project needs.

To use these chapters effectively, you need to understand basic SGML terminology from the ISO 8879 standard and how to read and write SGML markup declarations. (Appendix A, DTD Implementor's Quick Reference provides reference information on markup declaration syntax.) No matter what your level of expertise, you should have one of the several available SGML reference books handy (see Appendix E, Bibliography and Sources for suggestions). Remember also that existing DTDs make an excellent teaching tool.