Commit 2c228440 authored by William M. Brack's avatar William M. Brack
Browse files

changed xmlHasNsProp to properly handle a request for the default

* tree.c: changed xmlHasNsProp to properly handle a request for
  the default namespace (bug 153557)
parent c3f81345
Sat Oct 2 21:08:51 PDT 2004 William Brack <wbrack@mmm.com.hk>
* tree.c: changed xmlHasNsProp to properly handle a request for
the default namespace (bug 153557)
Sat Oct 2 18:18:27 PDT 2004 William Brack <wbrack@mmm.com.hk> Sat Oct 2 18:18:27 PDT 2004 William Brack <wbrack@mmm.com.hk>
* parser.c: fixed problem with dictionary handling within * parser.c: fixed problem with dictionary handling within
......
...@@ -5912,6 +5912,7 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) { ...@@ -5912,6 +5912,7 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) {
* This does the entity substitution. * This does the entity substitution.
* This function looks in DTD attribute declaration for #FIXED or * This function looks in DTD attribute declaration for #FIXED or
* default declaration values unless DTD use has been turned off. * default declaration values unless DTD use has been turned off.
* Note that a namespace of NULL indicates to use the default namespace.
* *
* Returns the attribute or the attribute declaration or NULL * Returns the attribute or the attribute declaration or NULL
* if neither was found. * if neither was found.
...@@ -5927,17 +5928,18 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) { ...@@ -5927,17 +5928,18 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
return(NULL); return(NULL);
prop = node->properties; prop = node->properties;
if (nameSpace == NULL)
return(xmlHasProp(node, name));
while (prop != NULL) { while (prop != NULL) {
/* /*
* One need to have * One need to have
* - same attribute names * - same attribute names
* - and the attribute carrying that namespace * - and the attribute carrying that namespace
*/ */
if ((xmlStrEqual(prop->name, name)) && if (xmlStrEqual(prop->name, name)) {
((prop->ns != NULL) && (xmlStrEqual(prop->ns->href, nameSpace)))) { if (((prop->ns != NULL) &&
return(prop); (xmlStrEqual(prop->ns->href, nameSpace))) ||
((prop->ns == NULL) && (nameSpace == NULL))) {
return(prop);
}
} }
prop = prop->next; prop = prop->next;
} }
...@@ -5970,16 +5972,25 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) { ...@@ -5970,16 +5972,25 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
return(NULL); return(NULL);
} }
cur = nsList; if (nameSpace == NULL) {
while (*cur != NULL) { attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename,
if (xmlStrEqual((*cur)->href, nameSpace)) { name, NULL);
attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename, if ((attrDecl == NULL) && (doc->extSubset != NULL)) {
name, (*cur)->prefix); attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename,
if ((attrDecl == NULL) && (doc->extSubset != NULL)) name, NULL);
attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename, }
} else {
cur = nsList;
while (*cur != NULL) {
if (xmlStrEqual((*cur)->href, nameSpace)) {
attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename,
name, (*cur)->prefix); name, (*cur)->prefix);
if ((attrDecl == NULL) && (doc->extSubset != NULL))
attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename,
name, (*cur)->prefix);
}
cur++;
} }
cur++;
} }
xmlFree(nsList); xmlFree(nsList);
xmlFree(ename); xmlFree(ename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment