Moving Objects

All of the moving functions remove a node from its original location and add it to another location among other nodes. The existing nodes are not affected, with the exception of xmlTreeSetRootElement(), as there can only be one root element.


EXAMPLE

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


SEE ALSO
xmlTreeAddChild, xmlTreeAddChildList, xmlTreeAddNextSibling, xmlTreeAddPrevSibling, xmlTreeAddSibling, xmlTreeSetRootElement, xmlTreeSetNs


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