[xml] errors management
- From: Francesco Gennai <francesco gennai isti cnr it>
- To: xml gnome org
- Subject: [xml] errors management
- Date: Thu, 13 Nov 2008 15:22:54 +0100
Hi,
I would like to capture any error from LIBXML API
and (if possible) have it in memory to process it
in my own error/debug routines.
Here is an example of code that can returns more than one error line.
pctxt.userData = (void *) stderr;
pctxt.error = (xmlValidityErrorFunc) fprintf;
pctxt.warning = (xmlValidityWarningFunc) fprintf;
if (!xmlValidateDtd(&pctxt, pdoc, pdtd)) {
xmlGenericError(xmlGenericErrorContext,
"Document %s does not validate against %s\n",
xmlFile, dtdFile);
such as:
No declaration for element dst
No declaration for attribute id of element dst
attribute ref line 5 references an unknown ID "foo"
attribute ref line 7 references an unknown ID "foo"
I would like an example how to modify the above code to capture
the error lines in some memory structure (chars array, ....).
Is it possible?
I suppose that it needs to write a function (like *printf functions)
to call in place of fprintf (in the above example).
Is there any example of code?
Francesco
I tried by changing fprintf with sprintf and stderr with (outerr) a character
string, but in this case I get
- only one line of the above errors
- I have the problem... how much length should be outerr chars array?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]