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
This commit is contained in:
Daniel Veillard 2002-07-06 17:53:56 +00:00
parent 8c9872ca2e
commit 37f961db6e
2 changed files with 30 additions and 4 deletions

View File

@ -1,3 +1,8 @@
Sat Jul 6 19:44:56 CEST 2002 Daniel Veillard <daniel@veillard.com>
* valid.c: fixing bug #79331 in one path the lookup for
ID attributes on a namespaced node wasn't handled correctly :-\
Fri Jul 5 20:07:43 CEST 2002 Daniel Veillard <daniel@veillard.com>
* HTMLparser.c: trying to fix 87235 about discarded white

29
valid.c
View File

@ -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);