In a DTD, entities come in four flavors:
A general entity is a chunk of text with a name attached, so you can use the entity as a sort of shorthand to get the related text substituted in its place.
For example, suppose you are working on a
new product called Project Giant-Slayer, but you know that
the marketing department will change the name when it's
released to the market. You could define the current product
name as an entity named
and use it everywhere in your product literature. Then,
when the marketing department decides on the final name,
you can change the declaration of the entity and the new
name will magically appear in place of the old one in all
your web pages and brochures.
A character entity is one of the many standardized special characters that you can use when you need a character unavailable in your local character set.
A parameter entity is like a general entity, but it can be used as shorthand for parts of a content declaration in an element declaration.
A binary or non-parsed entity represents an external file that is not in XML format.
General entities have names of the form
where the name follows
the usual rules for XML
To declare a general entity, use a declaration of this general form in your DTD:
is the name of the entity you are defining (without the
& and final
the text you want substituted for that entity.
For example, to define an entity named
&cr; with your copyright string,
you might use a declaration like this:
<!ENTITY cr "Copyright (C) 1763 Cotton Mather LLP">