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/include/libxml/xmlerror.h b/include/libxml/xmlerror.h
index 25d9db0..fa675ab 100644
--- a/include/libxml/xmlerror.h
+++ b/include/libxml/xmlerror.h
@@ -135,6 +135,30 @@
XML_ERR_URI_FRAGMENT /* 92 */
}xmlParserErrors;
+/*
+ * Signature of the function to use when there is an error and
+ * no parsing or validity context available
+ */
+typedef void (*xmlGenericErrorFunc) (void *ctx, const char *msg, ...);
+
+/*
+ * Those are the default error function and associated context to use
+ * when when there is an error and no parsing or validity context available
+ */
+
+extern xmlGenericErrorFunc xmlGenericError;
+extern void *xmlGenericErrorContext;
+
+/*
+ * Use the following function to reset the two previous global variables.
+ */
+void xmlSetGenericErrorFunc (void *ctx,
+ xmlGenericErrorFunc handler);
+
+/*
+ * Default message routines used by SAX and Valid context for error
+ * and warning reporting
+ */
void xmlParserError (void *ctx,
const char *msg,
...);