Commit f4e56298 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

applied patch from Kasimier Buchcik which fixes a problem in xmlSearchNs

* tree.c: applied patch from Kasimier Buchcik which fixes a
  problem in xmlSearchNs introduced in 2.6.0
Damniel
parent f5cb3cd9
Tue Oct 28 15:26:18 CET 2003 Daniel Veillard <daniel@veillard.com>
* tree.c: applied patch from Kasimier Buchcik which fixes a
problem in xmlSearchNs introduced in 2.6.0
Tue Oct 28 14:57:03 CET 2003 Daniel Veillard <daniel@veillard.com>
 
* parser.c: fixed #123263, the encoding is mandatory in a textdecl.
......
......@@ -5292,7 +5292,9 @@ xmlGetNsList(xmlDocPtr doc ATTRIBUTE_UNUSED, xmlNodePtr node)
*/
xmlNsPtr
xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
xmlNsPtr cur;
xmlNodePtr orig = node;
if (node == NULL) return(NULL);
if ((nameSpace != NULL) &&
......@@ -5350,16 +5352,18 @@ xmlSearchNs(xmlDocPtr doc, xmlNodePtr node, const xmlChar *nameSpace) {
return(cur);
cur = cur->next;
}
cur = node->ns;
if (cur != NULL) {
if ((cur->prefix == NULL) && (nameSpace == NULL) &&
(cur->href != NULL))
return(cur);
if ((cur->prefix != NULL) && (nameSpace != NULL) &&
(cur->href != NULL) &&
(xmlStrEqual(cur->prefix, nameSpace)))
return(cur);
}
if (orig != node) {
cur = node->ns;
if (cur != NULL) {
if ((cur->prefix == NULL) && (nameSpace == NULL) &&
(cur->href != NULL))
return(cur);
if ((cur->prefix != NULL) && (nameSpace != NULL) &&
(cur->href != NULL) &&
(xmlStrEqual(cur->prefix, nameSpace)))
return(cur);
}
}
}
node = node->parent;
}
......@@ -5482,14 +5486,16 @@ xmlSearchNsByHref(xmlDocPtr doc, xmlNodePtr node, const xmlChar * href)
}
cur = cur->next;
}
cur = node->ns;
if (cur != NULL) {
if ((cur->href != NULL) && (href != NULL) &&
(xmlStrEqual(cur->href, href))) {
if (xmlNsInScope(doc, orig, node, cur->href) == 1)
return (cur);
if (orig != node) {
cur = node->ns;
if (cur != NULL) {
if ((cur->href != NULL) && (href != NULL) &&
(xmlStrEqual(cur->href, href))) {
if (xmlNsInScope(doc, orig, node, cur->href) == 1)
return (cur);
}
}
}
}
}
node = node->parent;
}
......
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