As explained in Section 3.2, there are a
number of predefined entities which you can refer to in your
documents. These are defined either for general convenience or
because, as in the case of <
and &
,
the characters are significant to the SGML parser.
You can, however, define entities yourself, perhaps to save typing, or to parameterise a fragment of text which might change. Also, you would have to define an entity to refer to other files, or to other SGML documents.
You define entities in a section of the document which rejoices in
the name of the `internal declaration subset'. This is a
fragment of SGML markup which is presented within the
<!DOCTYPE>
declaration, which is formally read before
the reading of the actual DTD the declaration refers to. There are
many things you can do within the DTD subset, up to and including a
partial rewrite of the DTD (this is generally felt to be A Bad Thing
- do try to resist the temptation), but the main function of the DTD
subset in normal documents is to define a variety of types of
entities. For more details about the DTD subset, see
Appendix A.3.
The DTD subset is the only place you can define entities - the
<!ENTITY...>
declaration is forbidden in the body of
the document. While this is occasionally inconvenient, it helps keep
all the document's monkey-business in one place, and helps make future
processing that little bit more sane.