Re: [xml] libxml error redirection



It seems to work:

I defined a custom error handler:

void MyErrorHandler 
(void * userData, xmlErrorPtr error){
  // here we extract the information 
  // from xmlError struct 
}

Then, after I initialize libxml, I register my
handler:

//reset the generic error handler
initGenericErrorDefaultFunc(NULL);
//supply custom error handler
xmlSetStructuredErrorFunc(NULL, MyErrorHandler);

As an added bonus it seems to be picking up the errors
from libxslt as well

--Tavi

PS. Let me know If I'm missing anything

--- Daniel Veillard <veillard redhat com> wrote:

On Thu, Apr 27, 2006 at 11:22:01AM -0700, Octavian
Afilipoai wrote:
Also, I'm not sure how to register a callback for
parse error(s) and any other kind of errors or
warnings that libxml might generate.

Any ideas and/or code examples are appreciated.

  Register a structured error handler, see
xmlSetStructuredErrorFunc
   

http://xmlsoft.org/html/libxml-xmlerror.html#xmlSetStructuredErrorFunc

Daniel

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



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



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