Re: [xml] Return value of SAX getEntity callback.



On Mon, Apr 14, 2003 at 11:40:54AM +0100, Jonathan Wakely wrote:

Hi all,

I've added a getEntity callback to the SAX handler in libxml++ (a C++
wrapper around libxml2) and have a question about the return value.

  SAX + entities, be ready for a not too pleasant work ahead.

Because of the way the SaxHandler class is implemented there has to be a
default handler for the getEntity event, which users can then override
to change the behaviour (as opposed to the C API where you just don't
provide a getEntity callback if you're not interested in the event). 

  Okay,

Currently the default action is to do a lookup with
xmlGetPredefinedEntity(), but this will obviously only work if the
entity *is* one of the predefined set.

  Right

Looking at the libxml2 code again
I think returning a null xmlEntityPtr is the right thing to do, can
anyone confirm that, or point me in the right direction for a better
default?

  Well, there is no best way, entityDecl() will be called when there
is an entity declaration parsed. The DOM building code then associate
that to entities informations on the tree. You don't build a tree so
you have no place to hook those data. If you had then you could return
the informations stored about it.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]