xmlNode xmlTreeCopyNode(xmlDoc targetDoc, xmlNode node
[, int recursive])
xmlDocthat the new node/nodes will be placed into. This is only to help optimize internal string operations. It's possible to specify no doc by passing in an empty string (
nodeis going in the same document, it's common to use
xmlTreeGetDoc(node)as this parameter.
xmlNodeto be copied
recursive(optional) - If the
nodeto be copied is an element (as opposed to a comment, CDATA, etc.), setting
1will cause all child nodes of the element to be copied too.
0 by default.
xmlTreeCopyNode() makes a copy of
node (and its children
recursive is asserted). The newly-created copy is unlinked
and needs to be inserted into a tree, using things like
If you know where the copy is going, you can specify the target
document with the
targetDoc parameter to help optimize internal
string operations. Nothing will be broken if a different doc is
targetDoc than the one it ends up in once it is
<$newNode = (xmlTreeCopyNode(xmlTreeGetDoc($node), $node))>