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:
@ -1,3 +1,8 @@
|
|||||||
|
Mon Mar 24 19:38:05 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* tree.c xpath.c: some changes related to the new way of
|
||||||
|
handling Result Value Tree, before 2.5.5
|
||||||
|
|
||||||
Mon Mar 24 16:36:23 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Mon Mar 24 16:36:23 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* configure.in NEWS: preparing release 2.5.5
|
* configure.in NEWS: preparing release 2.5.5
|
||||||
|
36
tree.c
36
tree.c
@ -2967,6 +2967,14 @@ xmlFreeNodeList(xmlNodePtr cur) {
|
|||||||
xmlFreeNsList((xmlNsPtr) cur);
|
xmlFreeNsList((xmlNsPtr) cur);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ((cur->type == XML_DOCUMENT_NODE) ||
|
||||||
|
#ifdef LIBXML_DOCB_ENABLED
|
||||||
|
(cur->type == XML_DOCB_DOCUMENT_NODE) ||
|
||||||
|
(cur->type == XML_HTML_DOCUMENT_NODE)) {
|
||||||
|
#endif
|
||||||
|
xmlFreeDoc((xmlDocPtr) cur);
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
next = cur->next;
|
next = cur->next;
|
||||||
/* unroll to speed up freeing the document */
|
/* unroll to speed up freeing the document */
|
||||||
@ -4592,17 +4600,39 @@ xmlNodeGetContent(xmlNodePtr cur)
|
|||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
case XML_ENTITY_NODE:
|
case XML_ENTITY_NODE:
|
||||||
case XML_DOCUMENT_NODE:
|
|
||||||
case XML_HTML_DOCUMENT_NODE:
|
|
||||||
case XML_DOCUMENT_TYPE_NODE:
|
case XML_DOCUMENT_TYPE_NODE:
|
||||||
case XML_NOTATION_NODE:
|
case XML_NOTATION_NODE:
|
||||||
case XML_DTD_NODE:
|
case XML_DTD_NODE:
|
||||||
case XML_XINCLUDE_START:
|
case XML_XINCLUDE_START:
|
||||||
case XML_XINCLUDE_END:
|
case XML_XINCLUDE_END:
|
||||||
|
return (NULL);
|
||||||
|
case XML_DOCUMENT_NODE:
|
||||||
#ifdef LIBXML_DOCB_ENABLED
|
#ifdef LIBXML_DOCB_ENABLED
|
||||||
case XML_DOCB_DOCUMENT_NODE:
|
case XML_DOCB_DOCUMENT_NODE:
|
||||||
#endif
|
#endif
|
||||||
return (NULL);
|
case XML_HTML_DOCUMENT_NODE: {
|
||||||
|
xmlChar *tmp;
|
||||||
|
xmlChar *res = NULL;
|
||||||
|
|
||||||
|
cur = cur->children;
|
||||||
|
while (cur!= NULL) {
|
||||||
|
if ((cur->type == XML_ELEMENT_NODE) ||
|
||||||
|
(cur->type == XML_TEXT_NODE) ||
|
||||||
|
(cur->type == XML_CDATA_SECTION_NODE)) {
|
||||||
|
tmp = xmlNodeGetContent(cur);
|
||||||
|
if (tmp != NULL) {
|
||||||
|
if (res == NULL)
|
||||||
|
res = tmp;
|
||||||
|
else {
|
||||||
|
res = xmlStrcat(res, tmp);
|
||||||
|
xmlFree(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
|
return(res);
|
||||||
|
}
|
||||||
case XML_NAMESPACE_DECL: {
|
case XML_NAMESPACE_DECL: {
|
||||||
xmlChar *tmp;
|
xmlChar *tmp;
|
||||||
|
|
||||||
|
31
xpath.c
31
xpath.c
@ -3134,21 +3134,24 @@ xmlXPathObjectCopy(xmlXPathObjectPtr val) {
|
|||||||
case XPATH_XSLT_TREE:
|
case XPATH_XSLT_TREE:
|
||||||
if ((val->nodesetval != NULL) &&
|
if ((val->nodesetval != NULL) &&
|
||||||
(val->nodesetval->nodeTab != NULL)) {
|
(val->nodesetval->nodeTab != NULL)) {
|
||||||
xmlNodePtr cur, top, tmp;
|
xmlNodePtr cur, tmp;
|
||||||
|
xmlDocPtr top;
|
||||||
|
|
||||||
ret->boolval = 1;
|
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;
|
ret->user = top;
|
||||||
if (top != NULL) {
|
if (top != NULL) {
|
||||||
top->doc = (xmlDocPtr) top;
|
top->doc = top;
|
||||||
cur = val->nodesetval->nodeTab[0]->children;
|
cur = val->nodesetval->nodeTab[0]->children;
|
||||||
while (cur != NULL) {
|
while (cur != NULL) {
|
||||||
tmp = xmlDocCopyNode(cur, (xmlDocPtr) top, 1);
|
tmp = xmlDocCopyNode(cur, top, 1);
|
||||||
xmlAddChild(top, tmp);
|
xmlAddChild((xmlNodePtr) top, tmp);
|
||||||
cur = cur->next;
|
cur = cur->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret->nodesetval = xmlXPathNodeSetCreate(top);
|
ret->nodesetval = xmlXPathNodeSetCreate((xmlNodePtr) top);
|
||||||
} else
|
} else
|
||||||
ret->nodesetval = xmlXPathNodeSetCreate(NULL);
|
ret->nodesetval = xmlXPathNodeSetCreate(NULL);
|
||||||
/* Deallocate the copied tree value */
|
/* Deallocate the copied tree value */
|
||||||
@ -3279,8 +3282,6 @@ xmlXPathCastNumberToString (double val) {
|
|||||||
*/
|
*/
|
||||||
xmlChar *
|
xmlChar *
|
||||||
xmlXPathCastNodeToString (xmlNodePtr node) {
|
xmlXPathCastNodeToString (xmlNodePtr node) {
|
||||||
if ((node != NULL) && (node->type == XML_DOCUMENT_NODE))
|
|
||||||
node = xmlDocGetRootElement((xmlDocPtr) node);
|
|
||||||
return(xmlNodeGetContent(node));
|
return(xmlNodeGetContent(node));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3859,6 +3860,16 @@ xmlXPathNodeValHash(xmlNodePtr node) {
|
|||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return(0);
|
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) {
|
switch (node->type) {
|
||||||
case XML_COMMENT_NODE:
|
case XML_COMMENT_NODE:
|
||||||
@ -4270,6 +4281,10 @@ xmlXPathEqualNodeSetString(xmlXPathObjectPtr arg, const xmlChar * str, int neq)
|
|||||||
if (neq)
|
if (neq)
|
||||||
continue;
|
continue;
|
||||||
return (1);
|
return (1);
|
||||||
|
} else if ((str2 == NULL) && (xmlStrEqual(str, BAD_CAST ""))) {
|
||||||
|
if (neq)
|
||||||
|
continue;
|
||||||
|
return (1);
|
||||||
} else if (neq) {
|
} else if (neq) {
|
||||||
if (str2 != NULL)
|
if (str2 != NULL)
|
||||||
xmlFree(str2);
|
xmlFree(str2);
|
||||||
|
Reference in New Issue
Block a user