- 80 -
We’re treating both ENTITY and ENTITIES together because ENTITIES is the plural of
ENTITY. The ENTITY and ENTITIES attribute types are a way
of inserting entities into
attribute values. To use these types, you must have previously declared an entity in your
DTD (read the section on entities in this chapter for details on how to do this). The
ENTITY/ENTITY keyword is used in the declaration to tell
the parser to go find the
unparsed entity and pop it into the value of the attribute.
For example, if you wanted to insert a picture entity in to the value of a priority attribute
(say an up arrow), the following steps show you how to do it.
First, remember that the graphic needs to be declared as an entity somewhere in your
DTD. Though we haven’t yet talked about
Entity declarations in detail, here’s a possible
declaration of it:
Now that the up_arrow entity has been declared, the attribute
declaration could look like
this:
ENTITY
default
>
By declaring this, we’ve now said that a priority attribute can contain any previously
declared entity. Thus, a valid mail_item element under the above
declaration could look
like this:
more mail item
information
The ENTITIES type essentially tells the parser that a particular attribute can have one or
more entities. Continuing our mail_item theme, if you wanted to
include two entities in the
priority attribute (say an up arrow and a flag), you’d declare the attribute list as follows:
ENTITIES
default
>
Assuming that up_arrow and flag are previously declared entities, a valid example of
mail_item under this declaration is: