External DTD Subsets
Real-world DTDs can be quite complex. The SVG DTD is over 1,000 lines long. The XHTML 1.0 strict DTD (the smallest of the three XHTML DTDs) is more than 1,500 lines long. And these are only medium-sized DTDs. The DocBook XML DTD is over 11,000 lines long. It can be hard to work with, comprehend, and modify such a large DTD when it’s stored in a single monolithic file.
Fortunately, DTDs can be broken up into independent pieces. For instance, the DocBook DTD is distributed in 28 separate pieces covering different parts of the spec: one for tables, one for notations, one for entity declarations, and so on. These different pieces are then combined at validation time using external parameter entity references.
An external parameter entity is declared using a normal
ENTITY declaration with a
% sign just like a normal
parameter entity. However, rather than including the replacement
text directly, the declaration contains the SYSTEM keyword, followed by a URL to the
DTD piece it wants to include. For example, the following ENTITY declaration defines an external
entity called “names” whose content is taken from the file at the
relative URL names.dtd. Then the parameter
entity reference %names; inserts
the contents of that file into the current DTD.
<!ENTITY % names SYSTEM "names.dtd"> %names;
You can use either relative or absolute URLs. In most situations, relative URLs are more practical.