Deleting Objects

Objects aren't actually deleted in the xmlTree API, they're unlinked. This removes all references to the node from its tree, which removes it from the output. The XML API takes care of the deletion when necessary.

The object is not deleted until it is no longer accessible through any Vortex variable, so an unlinked node is still fully accessible from functions like xmlTreeGetName() and xmlTreeGetContent(), although things like xmlTreeGetParent() will not behave as before the unlinking.


<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'))>
<$ret = (xmlTreeUnlinkNode($age))>
<$output = (xmlTreePrintDoc($doc, 'INDENT'))>
output is $output


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