[Expat-discuss] Missing feature: Inability to request the use of SkippedEntityHandler through code alone.
Karl Waclawek
karl at waclawek.net
Wed May 31 01:32:12 CEST 2006
Max Bowsher wrote:
> For applications which need to reproduce the parsed XML with minimal
> representational change (e.g., so that the modified document can be
> reasonably diff-ed against the original), it is critical to know about
> entities themselves, rather than what they represent.
>
> However, even if the application provides a SkippedEntityHandler, expat
> ignores it, prefering to raise an error, unless the document itself
> contains a DTD including a parameter entity reference.
>
In specific circumstances the XML spec requires the parser to return an
error.
Here is a comment from expat.h regarding the skipped entity handler
:
/* This is called in two situations:
1) An entity reference is encountered for which no declaration
has been read *and* this is not an error.
2) An internal entity reference is read, but not expanded, because
XML_SetDefaultHandler has been called.
Note: skipped parameter entities in declarations and skipped general
entities in attribute values cannot be reported, because
the event would be out of sync with the reporting of the
declarations or attribute values
*/
> It should be possible for the application using expat to request that
> all undefined entities be reported to the SkippedEntityHandler
> regardless of the document itself.
>
That would not conform to the XML spec.
Maybe what you need can be approximated with the use of the default handler,
and maybe by inserting a standalone declaration or by calling
XML_SetParamEntityParsing with an appropriate value.
Karl
More information about the Expat-discuss
mailing list