[ expat-Patches-429501 ] predefined entities...

noreply@sourceforge.net noreply@sourceforge.net
Fri, 20 Jul 2001 22:40:15 -0700


Patches item #429501, was opened at 2001-06-01 19:52
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=310127&aid=429501&group_id=10127

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: David MacCormack (spoorancher)
Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: predefined entities...

Initial Comment:
Co-workers and myself have found it useful to be able 
to disable the expansion of default entities under 
certain circumstances.  For example, in a pipeline 
such as:
   app1 | app2 | app3

you only want app3 to actually expand default 
entities, otherwise you'll get wellformedness (is that 
a word ?:) errors if you have a character handler 
installed.

A buddy of mine actually hacked the xmltok_impl code 
and recompiled (which works quite well), but I decided 
to take a stab at providing a function/runtime means 
of changing this behavior.

The attached patch compiles, runs, and it produces the 
expected results against my test cases.

changes include:
   * new func decl in expat.h (or expat.h.in I suppose)
   * a few mods to xmlparse.c

Dave

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

>Comment By: David MacCormack (spoorancher)
Date: 2001-07-20 22:40

Message:
Logged In: YES 
user_id=234615

Hi Fred.  So if I'm following you, you'd define an 
XML_InternalEntityRefHandler callback -- or perhaps 
deprecate the current XML_ExternalEntityRefHandler and 
simply define a generic XML_EntityRefHandler, combining 
them as you did with XML_EntityDeclHandler -- as well as 
the accompanying XML_Set??? function.  And, if the user has 
set a callback, that will be called for each reference; 
otherwise, the current behavior will be done (as not to 
break existing code).  Is that the gist?

It's far more functionality than we (www.bna.com) need, but 
if (as you say) you want a generic solution that would 
allow the user to take any action (such as building a DOM), 
then it looks good to me... go for it :)!

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

Comment By: Fred L. Drake, Jr. (fdrake)
Date: 2001-07-20 20:24

Message:
Logged In: YES 
user_id=3066

Assigned to me since I'm interested in something similar.

Would you consider is acceptable to get a callback for all references to internal entities?  I'd like to have an event for internal entities defined in the internal subset and predefined entities like "lt" & friends.  You should be able to use a handler for that to present the output you require as well.  This would be useful when building a DOM or generating a SAX event stream that contains all the little niggly details.

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

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