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:
15
xpath.c
15
xpath.c
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user