xmlNode xmlTreeCopyNodeList(xmlDoc targetDoc, xmlNode node)


  • 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 first xmlNode of the node list to be copied


  • the first xmlNode of the new node list

xmlTreeCopyNodeList() creates a copy of a given node, its children (if they exist), and any of its further siblings.

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.


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

xmlTreeCopyDoc, xmlTreeCopyNode, xmlTreeCopyAttribute, xmlTreeCopyAttributeList

Copyright © Thunderstone Software     Last updated: Oct 24 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.