1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-09 04:58:16 +03:00

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
This commit is contained in:
Daniel Veillard 2003-10-28 14:27:41 +00:00
parent f5cb3cd9e9
commit f4e5629809
2 changed files with 28 additions and 17 deletions

View File

@ -1,3 +1,8 @@
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.

40
tree.c
View File

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