--- embedaddon/libxml2/error.c 2012/02/21 23:37:58 1.1.1.1 +++ embedaddon/libxml2/error.c 2013/07/22 01:22:22 1.1.1.2 @@ -452,6 +452,8 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, xmlErrorPtr to = &xmlLastError; xmlNodePtr baseptr = NULL; + if (code == XML_ERR_OK) + return; if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING)) return; if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) || @@ -459,8 +461,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) && + (ctxt->sax->serror != NULL)) { schannel = ctxt->sax->serror; + data = ctxt->userData; + } } /* * Check if structured error handler set @@ -473,16 +478,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; /* * Formatting the message */ @@ -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;