| Index: third_party/libxml/error.c | 
| diff --git a/third_party/libxml/error.c b/third_party/libxml/error.c | 
| index 5f03d940a2accacf46a1edd6100dc6001f1b2dcd..7508d41b074b488447ab474cdf2607e3938a2d9c 100644 | 
| --- a/third_party/libxml/error.c | 
| +++ b/third_party/libxml/error.c | 
| @@ -132,7 +132,7 @@ xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { | 
| */ | 
| void | 
| xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { | 
| -    xmlGenericErrorContext = ctx; | 
| +    xmlStructuredErrorContext = ctx; | 
| xmlStructuredError = handler; | 
| } | 
|  | 
| @@ -471,7 +471,7 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, | 
| * if user has defined handler, change data ptr to user's choice | 
| */ | 
| if (schannel != NULL) | 
| -	    data = xmlGenericErrorContext; | 
| +	    data = xmlStructuredErrorContext; | 
| } | 
| if ((domain == XML_FROM_VALID) && | 
| ((channel == xmlParserValidityError) || | 
| @@ -573,7 +573,6 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, | 
| if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) { | 
| to->file = (char *) xmlStrdup(node->doc->URL); | 
| } | 
| -	file = to->file; | 
| } | 
| to->line = line; | 
| if (str1 != NULL) | 
| @@ -593,20 +592,23 @@ __xmlRaiseError(xmlStructuredErrorFunc schannel, | 
| /* | 
| * Find the callback channel if channel param is NULL | 
| */ | 
| -    if ((ctxt != NULL) && (channel == NULL) && (xmlStructuredError == NULL) && (ctxt->sax != NULL)) { | 
| +    if ((ctxt != NULL) && (channel == NULL) && | 
| +        (xmlStructuredError == NULL) && (ctxt->sax != NULL)) { | 
| if (level == XML_ERR_WARNING) | 
| channel = ctxt->sax->warning; | 
| else | 
| channel = ctxt->sax->error; | 
| data = ctxt->userData; | 
| } else if (channel == NULL) { | 
| -        if (xmlStructuredError != NULL) | 
| +        if ((schannel == NULL) && (xmlStructuredError != NULL)) { | 
| schannel = xmlStructuredError; | 
| -	else | 
| +	    data = xmlStructuredErrorContext; | 
| +	} else { | 
| channel = xmlGenericError; | 
| -	if (!data) { | 
| -	data = xmlGenericErrorContext; | 
| -    } | 
| +	    if (!data) { | 
| +		data = xmlGenericErrorContext; | 
| +	    } | 
| +	} | 
| } | 
| if (schannel != NULL) { | 
| schannel(data, to); | 
| @@ -927,6 +929,7 @@ xmlCtxtResetLastError(void *ctx) | 
|  | 
| if (ctxt == NULL) | 
| return; | 
| +    ctxt->errNo = XML_ERR_OK; | 
| if (ctxt->lastError.code == XML_ERR_OK) | 
| return; | 
| xmlResetError(&ctxt->lastError); | 
|  |