applied fix from Mathias Hasselmann about a bug in URI parsing. fix bug
* uri.c: applied fix from Mathias Hasselmann about a bug in URI
parsing.
* xpath.c: fix bug #61291 the default XML namespace node is
missing from the namespace axis.
* tree.c: refuse to create namespaces nodes with prefix "xml"
Daniel
diff --git a/xpath.c b/xpath.c
index fd44e1a..8bbe15c 100644
--- a/xpath.c
+++ b/xpath.c
@@ -62,6 +62,14 @@
double xmlXPathStringEvalNumber(const xmlChar *str);
double xmlXPathDivideBy(double f, double fzero);
+static xmlNs xmlXPathXMLNamespaceStruct = {
+ NULL,
+ XML_NAMESPACE_DECL,
+ XML_XML_NAMESPACE,
+ BAD_CAST "xml"
+};
+static xmlNsPtr xmlXPathXMLNamespace = &xmlXPathXMLNamespaceStruct;
+
/************************************************************************
* *
* Floating point stuff *
@@ -79,6 +87,7 @@
double xmlXPathNAN = 0;
double xmlXPathPINF = 1;
double xmlXPathNINF = -1;
+static int xmlXPathInitialized = 0;
/**
* xmlXPathInit:
@@ -87,15 +96,13 @@
*/
void
xmlXPathInit(void) {
- static int initialized = 0;
-
- if (initialized) return;
+ if (xmlXPathInitialized) return;
xmlXPathPINF = trio_pinf();
xmlXPathNINF = trio_ninf();
xmlXPathNAN = trio_nan();
- initialized = 1;
+ xmlXPathInitialized = 1;
}
/**
@@ -4970,6 +4977,8 @@
* the order of nodes on this axis is implementation-defined; the axis will
* be empty unless the context node is an element
*
+ * We keep the XML namespace node at the end of the list.
+ *
* Returns the next element following that axis
*/
xmlNodePtr
@@ -4977,6 +4986,8 @@
xmlNodePtr ret;
if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL);
+ if (cur == (xmlNodePtr) xmlXPathXMLNamespace)
+ return(NULL);
if ((cur == NULL) || (ctxt->context->tmpNsList == NULL)) {
if (ctxt->context->tmpNsList != NULL)
xmlFree(ctxt->context->tmpNsList);
@@ -4989,6 +5000,7 @@
if (ret == NULL) {
xmlFree(ctxt->context->tmpNsList);
ctxt->context->tmpNsList = NULL;
+ return((xmlNodePtr) xmlXPathXMLNamespace);
}
return(ret);
}