1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

- tree.[ch] parser.c xpath.c: fixed the problem of addressing

attributes within the XML-1.0 namespace
Daniel
This commit is contained in:
Daniel Veillard
2001-02-16 00:11:46 +00:00
parent 6e6a6cc6e7
commit e0e265138e
6 changed files with 74 additions and 2 deletions

24
xpath.c
View File

@ -1344,6 +1344,12 @@ xmlXPathNsLookup(xmlXPathContextPtr ctxt, const xmlChar *prefix) {
return(NULL);
if (prefix == NULL)
return(NULL);
#ifdef XML_XML_NAMESPACE
if (xmlStrEqual(prefix, (const xmlChar *) "xml"))
return(XML_XML_NAMESPACE);
#endif
if (ctxt->nsHash == NULL)
return(NULL);
@ -3289,10 +3295,24 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt, xmlXPathAxisVal axis,
case XML_ATTRIBUTE_NODE: {
xmlAttrPtr attr = (xmlAttrPtr) cur;
if (xmlStrEqual(name, attr->name)) {
if (prefix == NULL) {
if ((attr->ns == NULL) ||
(attr->ns->prefix == NULL)) {
#ifdef DEBUG_STEP
n++;
n++;
#endif
addNode(ret, cur);
addNode(ret, attr);
}
} else {
if ((attr->ns != NULL) &&
(xmlStrEqual(prefix,
attr->ns->href))) {
#ifdef DEBUG_STEP
n++;
#endif
addNode(ret, attr);
}
}
}
break;
}