Fixes inherited from XSLT testing:
- xpath.c result/XPath/tests/chaptersbase
result/XPath/tests/simplebase: fixed XPath node()
- tree.c: small fix in xmlNewNs()
- Makefile.am: removed extraneous xml2Conf.sh rule
Daniel
diff --git a/ChangeLog b/ChangeLog
index 8c175f2..aa6bc49 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Jan 31 14:19:16 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
+
+ * xpath.c result/XPath/tests/chaptersbase
+ result/XPath/tests/simplebase: fixed XPath node()
+ * tree.c: small fix in xmlNewNs()
+ * Makefile.am: removed extraneous xml2Conf.sh rule
+
Sun Jan 28 08:37:03 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
* Makefile.am configure.in libxml.spec.in example/Makefile.am:
diff --git a/Makefile.am b/Makefile.am
index 0ef6ec3..f920cd5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -414,11 +414,11 @@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libxml-2.0.pc
-xml2Conf.sh: xml2Conf.sh.in Makefile
-## Use sed and then mv to avoid problems if the user interrupts.
- sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \
- -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \
- -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \
- -e 's?\@VERSION\@?$(VERSION)?g' \
- < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
- && mv xml2Conf.tmp xml2Conf.sh
+#xml2Conf.sh: xml2Conf.sh.in Makefile
+### Use sed and then mv to avoid problems if the user interrupts.
+# sed -e 's?\@XML_LIBDIR\@?$(XML_LIBDIR)?g' \
+# -e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \
+# -e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \
+# -e 's?\@VERSION\@?$(VERSION)?g' \
+# < $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
+# && mv xml2Conf.tmp xml2Conf.sh
diff --git a/result/XPath/tests/chaptersbase b/result/XPath/tests/chaptersbase
index fd4040e..03c6567 100644
--- a/result/XPath/tests/chaptersbase
+++ b/result/XPath/tests/chaptersbase
@@ -71,8 +71,12 @@
========================
Expression: /child::EXAMPLE/child::head/node()
Object is a Node Set :
-Set contains 1 nodes:
-1 ELEMENT title
+Set contains 3 nodes:
+1 TEXT
+ content=
+2 ELEMENT title
+3 TEXT
+ content=
========================
Expression: /descendant::title
diff --git a/result/XPath/tests/simplebase b/result/XPath/tests/simplebase
index 2ee65cb..38fa144 100644
--- a/result/XPath/tests/simplebase
+++ b/result/XPath/tests/simplebase
@@ -52,8 +52,12 @@
========================
Expression: /child::EXAMPLE/child::head/node()
Object is a Node Set :
-Set contains 1 nodes:
-1 ELEMENT title
+Set contains 3 nodes:
+1 TEXT
+ content=
+2 ELEMENT title
+3 TEXT
+ content=
========================
Expression: /descendant::title
diff --git a/tree.c b/tree.c
index a1ff183..1c80e3f 100644
--- a/tree.c
+++ b/tree.c
@@ -120,6 +120,9 @@
xmlNewNs(xmlNodePtr node, const xmlChar *href, const xmlChar *prefix) {
xmlNsPtr cur;
+ if ((node != NULL) && (node->type != XML_ELEMENT_NODE))
+ return(NULL);
+
/*
* Allocate a new Namespace and fill the fields.
*/
diff --git a/xpath.c b/xpath.c
index dc97244..4cfdd13 100644
--- a/xpath.c
+++ b/xpath.c
@@ -516,7 +516,7 @@
* Compare two nodes w.r.t document order
*
* Returns -2 in case of error 1 if first point < second point, 0 if
- * that's the same point, -1 otherwise
+ * that's the same node, -1 otherwise
*/
int
xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
@@ -2914,10 +2914,10 @@
} xmlXPathTestVal;
typedef enum {
+ NODE_TYPE_NODE = 0,
NODE_TYPE_COMMENT = XML_COMMENT_NODE,
NODE_TYPE_TEXT = XML_TEXT_NODE,
- NODE_TYPE_PI = XML_PI_NODE,
- NODE_TYPE_NODE = XML_ELEMENT_NODE
+ NODE_TYPE_PI = XML_PI_NODE
} xmlXPathTypeVal;
#define IS_FUNCTION 200
@@ -3050,6 +3050,10 @@
" context contains %d nodes\n",
nodelist->nodeNr);
switch (test) {
+ case NODE_TEST_NODE:
+ xmlGenericError(xmlGenericErrorContext,
+ " searching all nodes\n");
+ break;
case NODE_TEST_NONE:
xmlGenericError(xmlGenericErrorContext,
" searching for none !!!\n");
@@ -3109,9 +3113,14 @@
return;
case NODE_TEST_TYPE:
if ((cur->type == type) ||
- ((type == XML_ELEMENT_NODE) &&
+ ((type == NODE_TYPE_NODE) &&
((cur->type == XML_DOCUMENT_NODE) ||
- (cur->type == XML_HTML_DOCUMENT_NODE)))) {
+ (cur->type == XML_HTML_DOCUMENT_NODE) ||
+ (cur->type == XML_ELEMENT_NODE) ||
+ (cur->type == XML_PI_NODE) ||
+ (cur->type == XML_COMMENT_NODE) ||
+ (cur->type == XML_CDATA_SECTION_NODE) ||
+ (cur->type == XML_TEXT_NODE)))) {
#ifdef DEBUG_STEP
n++;
#endif