xmlTreeCopyNode

 

SYNOPSIS

xmlNode xmlTreeCopyNode(xmlDoc targetDoc, xmlNode node
                            [, int recursive])

Parameters:

  • targetDoc - the xmlDoc that 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 (''). If node is going in the same document, it's common to use xmlTreeGetDoc(node) as this parameter.

  • node - the xmlNode to be copied

  • recursive (optional) - If the node to be copied is an element (as opposed to a comment, CDATA, etc.), setting recursive to 1 will cause all child nodes of the element to be copied too.

    recursive is 0 by default.

Returns:

  • the new copy of node


DESCRIPTION
xmlTreeCopyNode() makes a copy of node (and its children if recursive is asserted). The newly-created copy is unlinked and needs to be inserted into a tree, using things like xmlTreeAddChild() or xmlTreeAddSibling().

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 specified in targetDoc than the one it ends up in once it is inserted.


EXAMPLE

<$newNode = (xmlTreeCopyNode(xmlTreeGetDoc($node), $node))>


SEE ALSO
xmlTreeCopyDoc, xmlTreeCopyNodeList, xmlTreeCopyAttribute, xmlTreeCopyAttributeList


Copyright © Thunderstone Software     Last updated: Sep 25 2019
Copyright © 2019 Thunderstone Software LLC. All rights reserved.