mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-30 22:43:14 +03:00
- tree.c: trying to fix #53574, not completely complete,
I would like xmllint --copy --debug test/ent1 and xmllint --debug test/ent1 to show the same result. - xpath.c: fix a bug when trying to sort namespace nodes Daniel
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Wed Apr 25 14:56:26 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
|
* tree.c: trying to fix #53574, not completely complete,
|
||||||
|
I would like xmllint --copy --debug test/ent1 and
|
||||||
|
xmllint --debug test/ent1 to show the same result.
|
||||||
|
* xpath.c: fix a bug when trying to sort namespace nodes
|
||||||
|
|
||||||
Wed Apr 25 12:28:57 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
Wed Apr 25 12:28:57 CEST 2001 Daniel Veillard <Daniel.Veillard@imag.fr>
|
||||||
|
|
||||||
* HTMLtree.c: real fix for #53402
|
* HTMLtree.c: real fix for #53402
|
||||||
|
42
tree.c
42
tree.c
@ -2617,6 +2617,7 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||||||
xmlNodePtr ret;
|
xmlNodePtr ret;
|
||||||
|
|
||||||
if (node == NULL) return(NULL);
|
if (node == NULL) return(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a new node and fill the fields.
|
* Allocate a new node and fill the fields.
|
||||||
*/
|
*/
|
||||||
@ -2684,7 +2685,19 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
|
|||||||
}
|
}
|
||||||
if (node->properties != NULL)
|
if (node->properties != NULL)
|
||||||
ret->properties = xmlCopyPropList(ret, node->properties);
|
ret->properties = xmlCopyPropList(ret, node->properties);
|
||||||
if (node->children != NULL)
|
if (node->type == XML_ENTITY_REF_NODE) {
|
||||||
|
if ((doc == NULL) || (node->doc != doc)) {
|
||||||
|
/*
|
||||||
|
* The copied node will go into a separate document, so
|
||||||
|
* to havoid dandling references to the ENTITY_DECL node
|
||||||
|
* we cannot keep the reference. Try to find it in the
|
||||||
|
* target document.
|
||||||
|
*/
|
||||||
|
ret->children = (xmlNodePtr) xmlGetDocEntity(doc, ret->name);
|
||||||
|
} else {
|
||||||
|
ret->children = node->children;
|
||||||
|
}
|
||||||
|
} else if (node->children != NULL)
|
||||||
ret->children = xmlStaticCopyNodeList(node->children, doc, ret);
|
ret->children = xmlStaticCopyNodeList(node->children, doc, ret);
|
||||||
UPDATE_LAST_CHILD_AND_PARENT(ret)
|
UPDATE_LAST_CHILD_AND_PARENT(ret)
|
||||||
return(ret);
|
return(ret);
|
||||||
@ -2696,10 +2709,17 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) {
|
|||||||
xmlNodePtr p = NULL,q;
|
xmlNodePtr p = NULL,q;
|
||||||
|
|
||||||
while (node != NULL) {
|
while (node != NULL) {
|
||||||
if( node->type == XML_DTD_NODE )
|
if( node->type == XML_DTD_NODE ) {
|
||||||
q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
|
if (doc->intSubset == NULL) {
|
||||||
else
|
q = (xmlNodePtr) xmlCopyDtd( (xmlDtdPtr) node );
|
||||||
q = xmlStaticCopyNode(node, doc, parent, 1);
|
q->doc = doc;
|
||||||
|
q->parent = parent;
|
||||||
|
doc->intSubset = (xmlDtdPtr) q;
|
||||||
|
} else {
|
||||||
|
q = (xmlNodePtr) doc->intSubset;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
q = xmlStaticCopyNode(node, doc, parent, 1);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
q->prev = NULL;
|
q->prev = NULL;
|
||||||
ret = p = q;
|
ret = p = q;
|
||||||
@ -2842,14 +2862,20 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) {
|
|||||||
ret->standalone = doc->standalone;
|
ret->standalone = doc->standalone;
|
||||||
if (!recursive) return(ret);
|
if (!recursive) return(ret);
|
||||||
|
|
||||||
if (doc->intSubset != NULL)
|
ret->last = NULL;
|
||||||
|
ret->children = NULL;
|
||||||
|
if (doc->intSubset != NULL) {
|
||||||
ret->intSubset = xmlCopyDtd(doc->intSubset);
|
ret->intSubset = xmlCopyDtd(doc->intSubset);
|
||||||
|
ret->intSubset->doc = ret;
|
||||||
|
ret->intSubset->parent = ret;
|
||||||
|
}
|
||||||
if (doc->oldNs != NULL)
|
if (doc->oldNs != NULL)
|
||||||
ret->oldNs = xmlCopyNamespaceList(doc->oldNs);
|
ret->oldNs = xmlCopyNamespaceList(doc->oldNs);
|
||||||
if (doc->children != NULL) {
|
if (doc->children != NULL) {
|
||||||
xmlNodePtr tmp;
|
xmlNodePtr tmp;
|
||||||
ret->children = xmlStaticCopyNodeList(doc->children, ret,
|
|
||||||
(xmlNodePtr)ret);
|
ret->children = xmlStaticCopyNodeList(doc->children, ret,
|
||||||
|
(xmlNodePtr)ret);
|
||||||
ret->last = NULL;
|
ret->last = NULL;
|
||||||
tmp = ret->children;
|
tmp = ret->children;
|
||||||
while (tmp != NULL) {
|
while (tmp != NULL) {
|
||||||
|
3
xpath.c
3
xpath.c
@ -1098,6 +1098,9 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
|
|||||||
*/
|
*/
|
||||||
if (node1 == node2)
|
if (node1 == node2)
|
||||||
return(0);
|
return(0);
|
||||||
|
if ((node1->type == XML_NAMESPACE_DECL) ||
|
||||||
|
(node2->type == XML_NAMESPACE_DECL))
|
||||||
|
return(1);
|
||||||
if (node1 == node2->prev)
|
if (node1 == node2->prev)
|
||||||
return(1);
|
return(1);
|
||||||
if (node1 == node2->next)
|
if (node1 == node2->next)
|
||||||
|
Reference in New Issue
Block a user