[Lazarus] DTD ENTITY question

Sergei Gorelkin sergei_gorelkin at mail.ru
Mon May 31 12:03:44 CEST 2010


Adem wrote:

> What is the general name for the adding stuff after the parameter 
> definition?
>> The tag <!ENTITY % name PUBLIC "foo" "bar"> declares the entity, and 
>> %name; is used to actually include it.
> IOW, the example above has already defined '%HTMLlat1;' so what is the 
> point in adding (seemingly superfluous) '%HTMLlat1;' *after* the 
> definition?

It's not superfluous. Defining the entity does not automatically include its content, it only tells 
the parser where to get this entity. Then, referencing an entity directs the parser to actually 
include its content. A single entity may be referenced multiple times. If an entity is never 
referenced, then its definition is obsolete and may be safely removed.

In your example, entity reference just happen to immediately follow the entity definition. There may 
be other constructs in between, e.g:

--- cut ---
<!ENTITY % HTMLlat1 PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "xhtml-lat1.ent">
<!ENTITY % HTMLsymbol PUBLIC "-//W3C//ENTITIES Symbols for XHTML//EN" "xhtml-symbol.ent">
<!ENTITY % HTMLspecial PUBLIC "-//W3C//ENTITIES Special for XHTML//EN" "xhtml-special.ent">

%HTMLlat1;
%HTMLsymbol;
%HTMLspecial;
--- cut ---

> OK. I am not really asking why; all I want to know is what would the 
> general name for such things?
> 
A parameter entity definition followed by parameter entity reference.

Regards,
Sergei




More information about the Lazarus mailing list