some changes related to the new way of handling Result Value Tree, before
* tree.c xpath.c: some changes related to the new way of
handling Result Value Tree, before 2.5.5
Daniel
diff --git a/xpath.c b/xpath.c
index ee339de..916b103 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3134,21 +3134,24 @@
case XPATH_XSLT_TREE:
if ((val->nodesetval != NULL) &&
(val->nodesetval->nodeTab != NULL)) {
- xmlNodePtr cur, top, tmp;
+ xmlNodePtr cur, tmp;
+ xmlDocPtr top;
ret->boolval = 1;
- top = xmlCopyNode(val->nodesetval->nodeTab[0], 0);
+ top = xmlNewDoc(NULL);
+ top->name = (char *)
+ xmlStrdup(val->nodesetval->nodeTab[0]->name);
ret->user = top;
if (top != NULL) {
- top->doc = (xmlDocPtr) top;
+ top->doc = top;
cur = val->nodesetval->nodeTab[0]->children;
while (cur != NULL) {
- tmp = xmlDocCopyNode(cur, (xmlDocPtr) top, 1);
- xmlAddChild(top, tmp);
+ tmp = xmlDocCopyNode(cur, top, 1);
+ xmlAddChild((xmlNodePtr) top, tmp);
cur = cur->next;
}
}
- ret->nodesetval = xmlXPathNodeSetCreate(top);
+ ret->nodesetval = xmlXPathNodeSetCreate((xmlNodePtr) top);
} else
ret->nodesetval = xmlXPathNodeSetCreate(NULL);
/* Deallocate the copied tree value */
@@ -3279,8 +3282,6 @@
*/
xmlChar *
xmlXPathCastNodeToString (xmlNodePtr node) {
- if ((node != NULL) && (node->type == XML_DOCUMENT_NODE))
- node = xmlDocGetRootElement((xmlDocPtr) node);
return(xmlNodeGetContent(node));
}
@@ -3859,6 +3860,16 @@
if (node == NULL)
return(0);
+ if (node->type == XML_DOCUMENT_NODE) {
+ tmp = xmlDocGetRootElement((xmlDocPtr) node);
+ if (tmp == NULL)
+ node = node->children;
+ else
+ node = tmp;
+
+ if (node == NULL)
+ return(0);
+ }
switch (node->type) {
case XML_COMMENT_NODE:
@@ -4270,6 +4281,10 @@
if (neq)
continue;
return (1);
+ } else if ((str2 == NULL) && (xmlStrEqual(str, BAD_CAST ""))) {
+ if (neq)
+ continue;
+ return (1);
} else if (neq) {
if (str2 != NULL)
xmlFree(str2);