diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2002-07-06 17:53:56 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2002-07-06 17:53:56 +0000 |
commit | 37f961db6ee47ecf9d67c5eb0945c37c79405d03 (patch) | |
tree | ef930839fc8b815b984f340a8acad313cd872d98 /valid.c | |
parent | 8c9872ca2e2d867236f4f5c3e0160bec499bf144 (diff) | |
download | android_external_libxml2-37f961db6ee47ecf9d67c5eb0945c37c79405d03.tar.gz android_external_libxml2-37f961db6ee47ecf9d67c5eb0945c37c79405d03.tar.bz2 android_external_libxml2-37f961db6ee47ecf9d67c5eb0945c37c79405d03.zip |
fixing bug #79331 in one path the lookup for ID attributes on a namespaced
* valid.c: fixing bug #79331 in one path the lookup for
ID attributes on a namespaced node wasn't handled correctly :-\
Daniel
Diffstat (limited to 'valid.c')
-rw-r--r-- | valid.c | 29 |
1 files changed, 25 insertions, 4 deletions
@@ -1928,10 +1928,31 @@ xmlIsID(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { xmlAttributePtr attrDecl; if (elem == NULL) return(0); - attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, attr->name); - if ((attrDecl == NULL) && (doc->extSubset != NULL)) - attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, - attr->name); + if ((elem->ns != NULL) && (elem->ns->prefix != NULL)) { + /* + * TODO: this sucks ... recomputing this every time is stupid + */ + int len = xmlStrlen(elem->name) + xmlStrlen(elem->ns->prefix) + 2; + xmlChar *fullname; + + fullname = xmlMalloc(len); + if (fullname == NULL) + return(0); + snprintf((char *) fullname, len, "%s:%s", (char *) elem->ns->prefix, + (char *) elem->name); + attrDecl = xmlGetDtdAttrDesc(doc->intSubset, fullname, + attr->name); + if ((attrDecl == NULL) && (doc->extSubset != NULL)) + attrDecl = xmlGetDtdAttrDesc(doc->extSubset, fullname, + attr->name); + xmlFree(fullname); + } else { + attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, + attr->name); + if ((attrDecl == NULL) && (doc->extSubset != NULL)) + attrDecl = xmlGetDtdAttrDesc(doc->extSubset, elem->name, + attr->name); + } if ((attrDecl != NULL) && (attrDecl->atype == XML_ATTRIBUTE_ID)) return(1); |