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.


<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

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

Copyright © Thunderstone Software     Last updated: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.