fixed bug #121210 (callback to sax->error, sax->warning with wrong
* SAX2.c, xmlIO.c: fixed bug #121210 (callback to sax->error,
sax->warning with wrong params).
diff --git a/SAX2.c b/SAX2.c
index c627b7c..8bdc118 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -366,8 +366,8 @@
ret = xmlGetDocEntity(ctxt->myDoc, name);
if (ret != NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
- "Entity(%s) document marked standalone but require external subset\n",
+ ctxt->sax->error(ctxt->userData,
+ "Entity(%s) document marked standalone but requires external subset\n",
name);
ctxt->valid = 0;
ctxt->wellFormed = 0;
@@ -395,8 +395,9 @@
if (val == 0) {
xmlAddChildList((xmlNodePtr) ret, children);
} else {
- ctxt->sax->error(ctxt,
- "Failure to process entity %s\n", name);
+ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
+ ctxt->sax->error(ctxt->userData,
+ "Failure to process entity %s\n", name);
ctxt->wellFormed = 0;
ctxt->valid = 0;
ctxt->validate = 0;
@@ -460,7 +461,7 @@
systemId, content);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
+ ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the internal subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
@@ -479,7 +480,7 @@
systemId, content);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
+ ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the external subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
@@ -495,7 +496,7 @@
}
} else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"SAX.xmlSAX2EntityDecl(%s) called while not in subset\n", name);
}
}
@@ -538,7 +539,7 @@
(xmlAttributeDefault) def, defaultValue, tree);
else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"SAX.xmlSAX2AttributeDecl(%s) called while not in subset\n", name);
return;
}
@@ -583,7 +584,7 @@
name, (xmlElementTypeVal) type, content);
else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"SAX.xmlSAX2ElementDecl(%s) called while not in subset\n",
name);
return;
@@ -619,7 +620,7 @@
if ((publicId == NULL) && (systemId == NULL)) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"SAX.xmlSAX2NotationDecl(%s) externalID or PublicID missing\n", name);
ctxt->valid = 0;
ctxt->wellFormed = 0;
@@ -632,7 +633,7 @@
publicId, systemId);
else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"SAX.xmlSAX2NotationDecl(%s) called while not in subset\n", name);
return;
}
@@ -671,7 +672,7 @@
publicId, systemId, notationName);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
+ ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the internal subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
@@ -691,7 +692,7 @@
publicId, systemId, notationName);
if ((ent == NULL) && (ctxt->pedantic) &&
(ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
+ ctxt->sax->warning(ctxt->userData,
"Entity(%s) already defined in the external subset\n", name);
if ((ent != NULL) && (ent->URI == NULL) && (systemId != NULL)) {
xmlChar *URI;
@@ -707,7 +708,7 @@
}
} else {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"SAX.xmlSAX2UnparsedEntityDecl(%s) called while not in subset\n", name);
}
}
@@ -924,7 +925,7 @@
if (uri == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
ctxt->sax->warning(ctxt->userData,
- "nmlns: %s not a valid URI\n", val);
+ "xmlns: %s not a valid URI\n", val);
} else {
if (uri->scheme == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
@@ -1028,8 +1029,9 @@
xmlAttrPtr prop;
namespace = xmlSearchNs(ctxt->myDoc, ctxt->node, ns);
if (namespace == NULL) {
- ctxt->sax->error(ctxt->userData,
- "Namespace prefix %s of attribute %s is not defined\n",
+ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
+ ctxt->sax->error(ctxt->userData,
+ "Namespace prefix %s of attribute %s is not defined\n",
ns, name);
}