[Expat-discuss] Parsing xml files with multiple external entities

Karl Waclawek karl@waclawek.net
Wed Apr 24 09:55:10 2002


> > Now, the XML spec says that a PE reference need only be included 
> > if the XML parser is validating, so, strictly speaking, I could
> > simply ignore PE references for which no declaration was reported.
> > 
> > Still, I find it strange, that Expat does not report entity
> > declarations when it reports the associated references.
> > 
> > Is this a bug?
> 
> I forgot to add: Expat reports these PE references in the
> *external* entity reference handler. 
> Without having reported the declarations, this just doesn't make sense, does it?

Tony,

Even if it is not a real bug (not sure), would you please
add it as a bug with Group = Feature Request?

I whipped up a quick fix, that has worked for me so far.
Basically, what I did is I followed the chain of state handlers
for general entity declarations and parameter entity declarations,
and where the state handler for parameter entity declarations
took a short cut, I added similar code as for the general
entity declarations.

I will upload the patch for whoever wants to check it out.
(it is based on the latest revisions of xmlparse.c and xmlrole.c)

Karl