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
diff --git a/xpath.c b/xpath.c
index adc3310..d56c70f 100644
--- a/xpath.c
+++ b/xpath.c
@@ -5200,6 +5200,15 @@
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 @@
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);
}