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

propagating xpath ancesstors node fix to c14n plus small performance

* c14n.c: propagating xpath ancesstors node fix to c14n                         plus small performance improvement to reduce number of                          mallocs                                                                         * xpath.c: fixed ancestors axis processing for namespace nodes
This commit is contained in:
Aleksey Sanin
2002-05-31 04:24:13 +00:00
parent 12171c4db1
commit dffd5c8dbc
3 changed files with 134 additions and 64 deletions

15
xpath.c
View File

@ -5200,6 +5200,15 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
return(att->parent);
}
case XML_NAMESPACE_DECL: {
xmlNsPtr ns = (xmlNsPtr) ctxt->context->node;
if ((ns->next != NULL) &&
(ns->next->type != XML_NAMESPACE_DECL))
return((xmlNodePtr) ns->next);
/* Bad, how did that namespace ended-up there ? */
return(NULL);
}
case XML_DOCUMENT_NODE:
case XML_DOCUMENT_TYPE_NODE:
case XML_DOCUMENT_FRAG_NODE:
@ -5208,12 +5217,6 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
case XML_DOCB_DOCUMENT_NODE:
#endif
return(NULL);
case XML_NAMESPACE_DECL:
/*
* this should not hapen a namespace can't be
* the ancestor of another node
*/
return(NULL);
}
return(NULL);
}