fixed to assure user data param is set correctly when user structured
* error.c: fixed to assure user data param is set correctly
when user structured error handler is called (bug 144823)
diff --git a/error.c b/error.c
index 05cc5b3..2e903dc 100644
--- a/error.c
+++ b/error.c
@@ -457,8 +457,17 @@
(ctxt->sax->initialized == XML_SAX2_MAGIC))
schannel = ctxt->sax->serror;
}
- if (schannel == NULL)
+ /*
+ * Check if structured error handler set
+ */
+ if (schannel == NULL) {
schannel = xmlStructuredError;
+ /*
+ * if user has defined handler, change data ptr to user's choice
+ */
+ if (schannel != NULL)
+ data = xmlGenericErrorContext;
+ }
if ((domain == XML_FROM_VALID) &&
((channel == xmlParserValidityError) ||
(channel == xmlParserValidityWarning))) {
@@ -541,7 +550,7 @@
xmlCopyError(to,&xmlLastError);
/*
- * Find the callback channel.
+ * Find the callback channel if channel param is NULL
*/
if ((ctxt != NULL) && (channel == NULL) && (xmlStructuredError == NULL)) {
if (level == XML_ERR_WARNING)