mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
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
This commit is contained in:
31
xpath.c
31
xpath.c
@ -3134,21 +3134,24 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
|
||||
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 @@ xmlXPathCastNumberToString (double val) {
|
||||
*/
|
||||
xmlChar *
|
||||
xmlXPathCastNodeToString (xmlNodePtr node) {
|
||||
if ((node != NULL) && (node->type == XML_DOCUMENT_NODE))
|
||||
node = xmlDocGetRootElement((xmlDocPtr) node);
|
||||
return(xmlNodeGetContent(node));
|
||||
}
|
||||
|
||||
@ -3859,6 +3860,16 @@ xmlXPathNodeValHash(xmlNodePtr node) {
|
||||
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 @@ xmlXPathEqualNodeSetString(xmlXPathObjectPtr arg, const xmlChar * str, int neq)
|
||||
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);
|
||||
|
Reference in New Issue
Block a user