1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00

fix to the XPath implementation for parent and ancestors axis when

* xpath.c: fix to the XPath implementation for parent and
  ancestors axis when operating on a Result Value Tree.
  Fixes bug #100271
Daniel
This commit is contained in:
Daniel Veillard 2003-01-10 17:06:09 +00:00
parent cacbe5d110
commit 8e7e1c00ce
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,9 @@
Fri Jan 10 18:04:32 CET 2003 Daniel Veillard <daniel@veillard.com>
* xpath.c: fix to the XPath implementation for parent and
ancestors axis when operating on a Result Value Tree.
Fixes bug #100271
Fri Jan 10 17:07:01 CET 2003 Daniel Veillard <daniel@veillard.com>
* nanoftp.c nanohttp.c xmlIO.c: patch from Stefano Zacchiroli

13
xpath.c
View File

@ -5268,6 +5268,10 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_ENTITY_DECL:
if (ctxt->context->node->parent == NULL)
return((xmlNodePtr) ctxt->context->doc);
if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) &&
(xmlStrEqual(ctxt->context->node->parent->name,
BAD_CAST "fake node libxslt")))
return(NULL);
return(ctxt->context->node->parent);
case XML_ATTRIBUTE_NODE: {
xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;
@ -5335,6 +5339,10 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_XINCLUDE_END:
if (ctxt->context->node->parent == NULL)
return((xmlNodePtr) ctxt->context->doc);
if ((ctxt->context->node->parent->type == XML_ELEMENT_NODE) &&
(xmlStrEqual(ctxt->context->node->parent->name,
BAD_CAST "fake node libxslt")))
return(NULL);
return(ctxt->context->node->parent);
case XML_ATTRIBUTE_NODE: {
xmlAttrPtr tmp = (xmlAttrPtr) ctxt->context->node;
@ -5380,6 +5388,11 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_ENTITY_DECL:
case XML_XINCLUDE_START:
case XML_XINCLUDE_END:
if (cur->parent == NULL)
return(NULL);
if ((cur->parent->type == XML_ELEMENT_NODE) &&
(xmlStrEqual(cur->parent->name, BAD_CAST "fake node libxslt")))
return(NULL);
return(cur->parent);
case XML_ATTRIBUTE_NODE: {
xmlAttrPtr att = (xmlAttrPtr) ctxt->context->node;