Hello,
The functions xmlAddNextSibling and xmlAddPrevSibling have a check which
checks if the element to be added is the same as the reference element.
xmlAddSibling however does not have such a check, resulting in the loss
of the element (the call to xmlUnlinkNode(elem) will unlink cur). I
think the equality check should be added to addSibling as well, like in
the attached patch.
Regards,
Kris Breuker
--- tree.c Sat Jan 17 14:45:34 2009
+++ tree_patched.c Wed Mar 11 12:16:22 2009
@@ -3103,6 +3103,14 @@
return(NULL);
}
+ if (cur == elem) {
+#ifdef DEBUG_TREE
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlAddSibling : cur == elem\n");
+#endif
+ return(NULL);
+ }
+
/*
* Constant time is we can rely on the ->parent->last to find
* the last sibling.
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml