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: Apr 15 2024
Copyright © 2024 Thunderstone Software LLC. All rights reserved.