RE: [xml] Re: XML libs (was Re: gconf backend)



On Sun, 2003-09-28 at 15:25, Stephane Bidoul wrote:
Daniel Veillard wrote:
Should a "last error" code and information pertaining to the parser
(and thread context) be kept. I think one person suggested 
this this week,
would this make a better API ? This doesn't prevent getting 
multiple error
callbacks, but would offer asynchronous handling that some 
people seems
to prefer.

Actually it's really not the fact that callback are 
synchronous that bothers me.

For instance, assume we have library A that uses libxml2, 
and library B that uses libxml2 too.
Both need to catch global error messages, but they don't
know about each other. They can't both register their own
global xmlGenericError at the same time, right?

The last error mechanism is only a proposal to work 
around this without requiring far reaching changes to 
the APIs. 

I save the current handler and set my own handler while I use libxml2,
then restore the old handler when I am done.  I think the last error
mechanism would be similar, you'd clear the error before calling and
check it after leaving the api.  The global handler is really a logging
function... if you have multiple contexts going, it's nice to be able to
tag the error with the context in the log because even though the error
might not have anything to do with the context (out of memory), you
still want to know which context failed so that you can resubmit it.




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