Copying Objects

The copying functions behave like the moving functions, except they leave the original copy of the node intact.

There are no namespace copying functions, as it's rare to need to actually copy a namespace. It's more common to simply use xmlTreeSetNs() to tell an object to use a namespace. See the Using Namespaces (here) section for more information.


EXAMPLE

<capture>
<rootNode><name>John Doe</name><age>34</age></rootNode>
</capture><$xmlRaw = $ret>
<$doc = (xmlTreeNewDocFromString( $xmlRaw, 'XML_PARSE_NOBLANKS'))>
<$root = (xmlTreeGetRootElement($doc))>
<$age = (xmlTreeGetChildren($root, 'age'))>
<$age2 = (xmlTreeCopyNode($root, $age, 1))>
<$output = (xmlTreePrintDoc($doc, 'INDENT'))>
output is $output


SEE ALSO
xmlTreeCopyDoc, xmlTreeCopyNode, xmlTreeCopyNodeList, xmlTreeCopyAttribute, xmlTreeCopyAttributeList


Copyright © Thunderstone Software     Last updated: Jun 15 2022
Copyright © 2022 Thunderstone Software LLC. All rights reserved.