You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by john Tourtellott <jo...@simmetrix.com> on 2002/06/29 20:57:00 UTC

XalanNode::cloneNode() behavior doesn't seem to match documentation

1. The documentation for the cloneNode() method in the XalanNode class
and subclasses indicates that "Cloning an Element copies all attributes
and their values, ... but this method does not copy any text it contains
unless it is a deep clone, since the text is contained in a child Text
node." My experience cloning an element (specifically, calling
XalanSourceTreeElement::cloneNode) is that the method always copies the
first child node (which in my case, is a text node) regardless of
whether it is a deep clone or not. Looking at the copy constructor in
XalanSourceTreeElement.cpp seems to confirm this.


2. Also, the documentation for the "deep" parameter states that "If
true, recursively clone the subtree under the specified node; if false,
clone only the node itself", but I see no sign of this recursive
behavior in the Xalan source code. My test programs confirm this also.


Am I missing something here? Is there a way to clone an XalanNode
without copying it's child text node?
Also, is there a way to recursively clone a node and it's full subtree?

john