[ expat-Bugs-552297 ] Request for skippedEntity handler

noreply@sourceforge.net noreply@sourceforge.net
Thu May 9 06:36:06 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: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Karl Waclawek (kwaclaw)
Assigned to: Nobody/Anonymous (nobody)
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: 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