diff --git a/error.c b/error.c index 7508d41..deda40c 100644 --- a/error.c +++ b/error.c @@ -459,8 +459,11 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) { ctxt = (xmlParserCtxtPtr) ctx; if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && - (ctxt->sax->initialized == XML_SAX2_MAGIC)) + (ctxt->sax->initialized == XML_SAX2_MAGIC)) { schannel = ctxt->sax->serror; + if (schannel) + data = ctxt->userData; + } } /* * Check if structured error handler set @@ -473,14 +476,6 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, if (schannel != NULL) data = xmlStructuredErrorContext; } - if ((domain == XML_FROM_VALID) && - ((channel == xmlParserValidityError) || - (channel == xmlParserValidityWarning))) { - ctxt = (xmlParserCtxtPtr) ctx; - if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) && - (ctxt->sax->initialized == XML_SAX2_MAGIC)) - schannel = ctxt->sax->serror; - } if (code == XML_ERR_OK) return; /* @@ -589,6 +584,11 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, if (to != &xmlLastError) xmlCopyError(to,&xmlLastError); + if (schannel != NULL) { + schannel(data, to); + return; + } + /* * Find the callback channel if channel param is NULL */ @@ -600,19 +600,9 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, channel = ctxt->sax->error; data = ctxt->userData; } else if (channel == NULL) { - if ((schannel == NULL) && (xmlStructuredError != NULL)) { - schannel = xmlStructuredError; - data = xmlStructuredErrorContext; - } else { - channel = xmlGenericError; - if (!data) { - data = xmlGenericErrorContext; - } - } - } - if (schannel != NULL) { - schannel(data, to); - return; + channel = xmlGenericError; + if (!data) + data = xmlGenericErrorContext; } if (channel == NULL) return;