mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-27 18:50:07 +03:00
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)
This commit is contained in:
parent
c3f8134511
commit
2c22844057
@ -1,3 +1,8 @@
|
||||
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>
|
||||
|
||||
* parser.c: fixed problem with dictionary handling within
|
||||
|
39
tree.c
39
tree.c
@ -5912,6 +5912,7 @@ xmlHasProp(xmlNodePtr node, const xmlChar *name) {
|
||||
* This does the entity substitution.
|
||||
* This function looks in DTD attribute declaration for #FIXED or
|
||||
* 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
|
||||
* if neither was found.
|
||||
@ -5927,17 +5928,18 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
|
||||
return(NULL);
|
||||
|
||||
prop = node->properties;
|
||||
if (nameSpace == NULL)
|
||||
return(xmlHasProp(node, name));
|
||||
while (prop != NULL) {
|
||||
/*
|
||||
* One need to have
|
||||
* - same attribute names
|
||||
* - and the attribute carrying that namespace
|
||||
*/
|
||||
if ((xmlStrEqual(prop->name, name)) &&
|
||||
((prop->ns != NULL) && (xmlStrEqual(prop->ns->href, nameSpace)))) {
|
||||
return(prop);
|
||||
if (xmlStrEqual(prop->name, name)) {
|
||||
if (((prop->ns != NULL) &&
|
||||
(xmlStrEqual(prop->ns->href, nameSpace))) ||
|
||||
((prop->ns == NULL) && (nameSpace == NULL))) {
|
||||
return(prop);
|
||||
}
|
||||
}
|
||||
prop = prop->next;
|
||||
}
|
||||
@ -5970,16 +5972,25 @@ xmlHasNsProp(xmlNodePtr node, const xmlChar *name, const xmlChar *nameSpace) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
cur = nsList;
|
||||
while (*cur != NULL) {
|
||||
if (xmlStrEqual((*cur)->href, nameSpace)) {
|
||||
attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename,
|
||||
name, (*cur)->prefix);
|
||||
if ((attrDecl == NULL) && (doc->extSubset != NULL))
|
||||
attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename,
|
||||
name, (*cur)->prefix);
|
||||
if (nameSpace == NULL) {
|
||||
attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename,
|
||||
name, NULL);
|
||||
if ((attrDecl == NULL) && (doc->extSubset != NULL)) {
|
||||
attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename,
|
||||
name, NULL);
|
||||
}
|
||||
} else {
|
||||
cur = nsList;
|
||||
while (*cur != NULL) {
|
||||
if (xmlStrEqual((*cur)->href, nameSpace)) {
|
||||
attrDecl = xmlGetDtdQAttrDesc(doc->intSubset, ename,
|
||||
name, (*cur)->prefix);
|
||||
if ((attrDecl == NULL) && (doc->extSubset != NULL))
|
||||
attrDecl = xmlGetDtdQAttrDesc(doc->extSubset, ename,
|
||||
name, (*cur)->prefix);
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
cur++;
|
||||
}
|
||||
xmlFree(nsList);
|
||||
xmlFree(ename);
|
||||
|
Loading…
x
Reference in New Issue
Block a user