aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--SAX.c16
-rw-r--r--parser.c11
3 files changed, 30 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 0809e1ca..9a298709 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Thu Jul 24 17:07:06 IST 2003 Daniel Veillard <daniel@veillard.com>
+
+ * SAX.c parser.c: fixing a bug about a special case of namespace
+ handling, this closes bug #116841
+
Wed Jul 23 20:52:36 IST 2003 Daniel Veillard <daniel@veillard.com>
* relaxng.c result/relaxng/*: checked and fixed the compilation
diff --git a/SAX.c b/SAX.c
index df30c625..3f628942 100644
--- a/SAX.c
+++ b/SAX.c
@@ -862,6 +862,22 @@ my_attribute(void *ctx, const xmlChar *fullname, const xmlChar *value,
* Split the full name into a namespace prefix and the tag name
*/
name = xmlSplitQName(ctxt, fullname, &ns);
+ if ((name != NULL) && (name[0] == 0)) {
+ if (xmlStrEqual(ns, BAD_CAST "xmlns")) {
+ if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
+ ctxt->sax->error(ctxt->userData,
+ "invalid namespace declaration '%s'\n", fullname);
+ } else {
+ if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL))
+ ctxt->sax->warning(ctxt->userData,
+ "Avoid attribute ending with ':' like '%s'\n", fullname);
+ }
+ if (ns != NULL)
+ xmlFree(ns);
+ ns = NULL;
+ xmlFree(name);
+ name = xmlStrdup(fullname);
+ }
if (name == NULL) {
if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
ctxt->sax->error(ctxt->userData,
diff --git a/parser.c b/parser.c
index 0e634d04..7d93c330 100644
--- a/parser.c
+++ b/parser.c
@@ -1729,7 +1729,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
return(xmlStrdup(name));
#endif
- /* nasty but valid */
+ /* nasty but well=formed */
if (cur[0] == ':')
return(xmlStrdup(name));
@@ -1771,6 +1771,11 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
buffer[len] = 0;
}
+ /* nasty but well=formed
+ if ((c == ':') && (*cur == 0)) {
+ return(xmlStrdup(name));
+ } */
+
if (buffer == NULL)
ret = xmlStrndup(buf, len);
else {
@@ -1782,8 +1787,10 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) {
if (c == ':') {
c = *cur;
- if (c == 0) return(ret);
*prefix = ret;
+ if (c == 0) {
+ return(xmlStrndup("", 0));
+ }
len = 0;
/*