[xml] libxml error redirection
- From: Octavian Afilipoai <atavi10 yahoo com>
- To: xml gnome org
- Subject: [xml] libxml error redirection
- Date: Thu, 27 Apr 2006 11:22:01 -0700 (PDT)
Hi,
I was wondering what is the best way to tap into the
error reporting mechanism of libxml.
My app has a GUI, and I want to redirect to a string
the error message(s) that are going to the console by
default . I could, then, display that string into a
pop-up box, for example.
I noticed that I can register a callback (in this case
sprintf) for error(s) resulting from DTD validation
like this:
...............
xmlValidCtxtPtr cvp=xmlNewValidCtxt();
char err_msg[MSG_MAX_SIZE];
cvp->userData = (void *) err_msg;
cvp->error = (xmlValidityErrorFunc) sprintf;
cvp->warning = (xmlValidityWarningFunc) sprintf;
................
The problem with this method is that it's prone to
buffer overflow since I don't know what the max
message size will be.
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.
--Tavi
__________________________________________________
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]