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.


EXAMPLE

<capture>
<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


SEE ALSO
xmlTreeUnlinkNode


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