summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
authorAron Xu <aron@debian.org>2012-05-25 04:03:35 +0000
committerAron Xu <aron@debian.org>2012-05-25 04:03:35 +0000
commitd7372d053bbd1d58216fbb04d1771ffa4cc3e624 (patch)
tree62b661911406394bbeaca8951d660bb6d8aac0de /error.c
parent2d1849b271fa8697b88d07ba7d78dc83591e1363 (diff)
downloadlibxml2-d7372d053bbd1d58216fbb04d1771ffa4cc3e624.tar.gz
Imported Upstream version 2.8.0+dfsg1upstream/2.8.0+dfsg1
Diffstat (limited to 'error.c')
-rw-r--r--error.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/error.c b/error.c
index 7508d41..a891faa 100644
--- a/error.c
+++ b/error.c
@@ -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;