Previous | Table of Contents | Next |
Often youll have several DTDs you deal with on a regular basis. Youll increase your overall efficiency if you design modular components or groups of structures that can be used by several DTDs. When there are many different types of documents with similar structures, these modular components make maintaining your DTDs a lot easier (see fig. 4.4).
Fig. 4.4 DTD components help you reuse parts of your DTDs. They also make maintaining your DTDs much easier.
Many times, especially in big companies, theres more than one developer of DTDs. Usually, there is a team that develops the DTDs. Often, other people have to maintain the DTDs after the original developers are gone. The people who maintain the DTDs will change over time also. Making modular DTD components makes maintaining them far easier for everybody over the life of your documents and DTDs.
See When (and Why) To Use DTD Components and How To Make Components, pp. 190, 197 See Maintaining Your DTD, p. 239
Note:
SGMLs tremendous flexibility allows you to handle groups of document structures in many different ways to suit your own objectives. For example, if you observe that your magazine articles and your service bulletins both require math equation structures, you might find it helpful to build a common DTD that contains these structures so both your service bulletins and magazine article DTDs can take advantage of the same common structures. Common DTDs contain groups of structures that can be used by multiple DTDs. This makes maintenance much more convenient and orderly than having duplicate structures in several DTDs.
DTDs are like computer programs. They grow and evolve as peoples needs evolve. Even if you have a single DTD to manage, youre still going to have to tweak it in time.
There are basically three ways to make modular components for DTDs, and they all depend on using parameter entities in DTDs:
See Fragment Assembly, p. 198 See DTD Redefinition, p. 198
See Defining Parameter Entities as Elements, p. 199
You evaluate DTDs by parsing them. The parser checks the DTD for compliance with the SGML standard and reports errors. Not only must your DTD specify your document design, it must do so within the rules of the SGML standard.
See Evaluating Your DTD, p. 233
Parsing a DTD is different from parsing an SGML document. The parser ensures that a document instance conforms to the definition specified in its DTD. The same parser ensures that the DTD follows the logic and syntax rules specified in the SGML standard. The DTD must strictly follow the international SGML standard so that when document instances are compared to it, the parsers analysis will be accurate.
If you dont want to be the cause of someone elses misery, youll format your DTDs for people, not just the parser. Structure your declarations into groups so they can be easily located in the DTD. Add comments and notes throughout, just as you would in a computer program, so the next person can pick up the threads that you leave behind. Remember, there might be four or five different peopleor morewho will maintain a DTD over its lifetime.
See Why Formatting DTDs Is Important, p. 201
Because SGML is designed to be flexible, its conventions can tempt you to be too flexible and make unwise design decisions in your DTDs. Here are some common examples of poor decisions that you could make:
Previous | Table of Contents | Next |