[ expat-Bugs-552297 ] Request for skippedEntity handler

noreply@sourceforge.net noreply@sourceforge.net
Thu May 16 16:45:03 2002


Bugs item #552297, was opened at 2002-05-04 13:41
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=552297&group_id=10127

Category: None
>Group: Feature Request
Status: Open
Resolution: None
Priority: 5
Submitted By: Karl Waclawek (kwaclaw)
>Assigned to: Karl Waclawek (kwaclaw)
Summary: Request for skippedEntity handler

Initial Comment:
It would be very useful if Expat reported skipped
entities, like in the SAX2 specification.

I have identified the following situations for that:

B) External Entities are reported as skipped:
   - if no external entity ref handler is set
   - if the entity ref handler returns a special value
     (e.g. we can define 2 as meaning: "skip this one")

B) Internal Entities are reported as skipped:
   - SetDefaultHandler was called (which turns off
     expansion of internal general entities)

C) Any entity reference is reported as skipped
   - if no declaration is found & that is not an error
     (otherwise return a well-formedness error)


Karl

----------------------------------------------------------------------

>Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2002-05-16 19:44

Message:
Logged In: YES 
user_id=3066

This feature description and proposed callback interface
sounds good to me.  We might want to think about how such a
handler would interact with (or be combined with) a handler
so that defined general entities (including "standard" ones
like < and friends) can be reported, for applications
that need to produce output with minimal changes.  (This is
commonly needed if the output is going to land in front of a
human rather than another processing tool.)

Let's target this for 1.95.4.  Assigning to Karl since he's
indicated specific interest.  ;-)

----------------------------------------------------------------------

Comment By: Karl Waclawek (kwaclaw)
Date: 2002-05-09 09:35

Message:
Logged In: YES 
user_id=290026

I propose the following signature for the handler:

enum XML_Skip_Reason {
  XML_SKIP_UNDEFINED,
  XML_SKIP_NOHANDLER,
  XML_SKIP_REQUESTED
};

typedef void (*XML_SkippedEntityHandler)
  (void *userData,
   const XML_Char *entityName,
   int is_parameter_entity,
   const XML_Char *systemId,
   const XML_Char *publicId,
   enum XML_Skip_Reason skipReason);

where the values of skipReason have the following meanings:

- XML_SKIP_UNDEFINED: entity was skipped because no 
  declaration was found, and this was not an error
- XML_SKIP_NOHANDLER: entity was skipped because there was
  no ExternalEntityRefHandler installed
- XML_SKIP_REQUESTED: the ExternalEntityRefHandler returned
  a value of 2, which means the handler requested the
  entity to be skipped

I hope this makes sense. Comments welcome!

Karl



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=110127&aid=552297&group_id=10127