Re: Parameter Entities

Deborah A. Lapeyre <dlapeyre@mulberrytech.com> wrote:
> 
> Quick, before a final vote can go in, we would like to plead for both 
> internal and external paramter entities.  The utility of these to a 
> creator of modular DTDs is obvious.  Therefore, I need them, want them, 
> would give them up only with regret.

Heartily seconded.

> May I please hear the other side?  ARE they (particluarly the external) 
> very hard to build into a parser or perl hack.  Please be specific?
> Is the objection to external based on Web resolving?

Dealing with parameter entities takes a bit of forethought,
but it doesn't seem to be overwhelmingly difficult to implement.
You can't just treat the input as a single stream of characters:
you have to either keep a stack of open entities, push back the
replacement text as soon as an entity is referenced (as in
Earl Hood's Perl-SGML tools), or do something else.

This is tough only if you insist on using LEX and YACC.
It's pretty straightforward with a hand-written scanner,
and I suspect that one could get FLEX to handle it too with 
a little effort.

The major complication is, as you mentioned, potential network
latency in resolving external entities.  If we add the restriction
that external parameter entities may not contain definitions
for other parameter entities that are later used in the
referring entity, and that external parameter entities 
must consist of one or more complete markup declarations
(which is usually the case), then resolution of external
parameter entities can be deferred just like external
general entities.  

For example:

    <!-- in "main.dtd" -->
    <!ENTITY % Sub SYSTEM "sub.dtd">
    %Sub;

"sub.dtd" cannot declare any parameter entities that are used
later on in "main.dtd", and constructs like:

    <!ELEMENT BODY - - %body.content; >

are only be allowed if %body.content; is an internal entity.
Given these restrictions, external parameter entities can
be treated much the same as external general entities in XML.


> Is their presence a real problem for smaller, simpler implementations?

I would hypothesize that the smaller, simpler applications --
the ones we expect CS majors to be able to write in a week --
will for the most part not read the DTD at all.


--Joe English

  jenglish@crl.com

Received on Tuesday, 5 November 1996 16:15:22 UTC