|
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: Mon Feb 18 10:28:15 EST 2013
|