Re: [xml] xmlGenericErrorFunc error handling



On Tue, Oct 11, 2005 at 02:32:04PM -0600, Jason Aeschilman wrote:
Other people on this list pointed out that if you're creating your own error
handler, you have to deal with your error handler being called multiple
times for a single error.  So here is my question:

How can I safely gather the entire error message and output it to a log file
in one line?

What I have done to work around this so far is to store all the pieces of
the error message in a static buffer (static char *) until I receive the
piece (string) that ends in a newline character, then I copy the buffer to
my logging function (also prepending "libxml:" to it).  Therefore, I'm
making the assumption that I will eventually get a string that ends in a
newline character.  I'm not sure if that's a safe assumption.

  no. You're better off using the structured error callback then.
Note than an error may generate another one, etc... 

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]