diff options
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | SAX.c | 16 | ||||
| -rw-r--r-- | parser.c | 11 |
3 files changed, 30 insertions, 2 deletions
@@ -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 @@ -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, @@ -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; /* |
