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/ChangeLog b/ChangeLog
index 482421c..eaedc79 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Sep 6 10:55:01 PTD 2003 William Brack <wbrack@mmm.com.hk>
+
+ * SAX2.c, xmlIO.c: fixed bug #121210 (callback to sax->error,
+ sax->warning with wrong params).
+
Fri Sep 5 10:33:42 CEST 2003 Daniel Veillard <daniel@veillard.com>
* include/libxml/globals.h: patch from Stéphane Bidoul to export
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);
}
diff --git a/xmlIO.c b/xmlIO.c
index 83907f9..d100948 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -2609,10 +2609,10 @@
ID = "NULL";
if ((ctxt->validate) && (ctxt->sax != NULL) &&
(ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"failed to load external entity \"%s\"\n", ID);
else if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
+ ctxt->sax->warning(ctxt->userData,
"failed to load external entity \"%s\"\n", ID);
return(NULL);
}
@@ -2620,10 +2620,10 @@
if (ret == NULL) {
if ((ctxt->validate) && (ctxt->sax != NULL) &&
(ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt,
+ ctxt->sax->error(ctxt->userData,
"failed to load external entity \"%s\"\n", resource);
else if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
- ctxt->sax->warning(ctxt,
+ ctxt->sax->warning(ctxt->userData,
"failed to load external entity \"%s\"\n", resource);
}
if ((resource != NULL) && (resource != (xmlChar *) URL))