patched to redirrect all "out of context" error messages to
a reconfigurable routine. The changes are:
* xmlerror.h : added the export of an error context type (void *)
an error handler type xmlGenericErrorFunc there is an interface
xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler);
to reset the error handling routine and its argument
(by default it's equivalent to respectively fprintf and stderr.
* all the c files: all wild accesses to stderr or stdout within
the library have been replaced to calls to the handler.
Daniel
diff --git a/testHTML.c b/testHTML.c
index 541620e..6a2a896 100644
--- a/testHTML.c
+++ b/testHTML.c
@@ -40,6 +40,7 @@
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#include <libxml/debugXML.h>
+#include <libxml/xmlerror.h>
#ifdef LIBXML_DEBUG_ENABLED
static int debug = 0;
@@ -719,7 +720,8 @@
doc = htmlParseFile(filename, NULL);
}
if (doc == NULL) {
- fprintf(stderr, "Could not parse %s\n", filename);
+ xmlGenericError(xmlGenericErrorContext,
+ "Could not parse %s\n", filename);
}
/*