HTML and CSS Reference
An entity is essentially a macro that allows a short name to be associated with replacement
text. Parameter entities define replacement text used in DTD declarations. Syntactically, a
parameter entity is distinguished by using the percent (%) symbol. Its general form is
<!ENTITY % name "replacement text">
It is used in DTDs as follows:
Parameter entities are a convenient way to define commonly occurring pieces of a DTD
so that changes only need to be made in one place. We see in XHTML a parameter entity to
define the core attributes common to most elements.
<!ENTITY % coreattrs
"id ID #IMPLIED
class CDATA #IMPLIED
style %StyleSheet; #IMPLIED
title %Text; #IMPLIED"
Notice that entity %coreattrs further references entities ( %StyleSheet; and %Text; )
to define values for the style and title attributes. Once defined, the core attributes could be
added to an attribute list declaration for an element as follows:
<!ATTLIST some-element %coreattrs;>
Oftentimes, you will see entities that in turn contain further entities. For example, under
HTML 4.0, the coreattrs parameter entity is used with the i18n and events parameter
entities to define the expansion text for an aggregate entity called attrs .
<!ENTITY % attrs "%coreattrs %i18n %events">
DTDs in both SGML and XML contain comments familiar to Web page authors:
<!-- this is a comment -->
Generally these comments are used to segment the specification
<!--================ Forms =============================================-->
but in some cases, they may be used to provide explanations of particular elements or their use.
<!-- INS/DEL are handled by inclusion on BODY -->