XmlFreeNode Function

Removes and frees memory for nodes and sub-nodes.

Usage

status = XmlFreeNode(node_id)

Input Parameters

node_id—The node ID that is used to free and release memory.

Returned Value

status—A value of 1 is returned if the operation was successful.

Discussion

This routine is used to remove a node and all sub-nodes in a node tree. It is usually used with the node ids returned by XmlEvaluate, but can also be used with the node ID returned from XmlNewNode. Be careful to only call this routine once for a given node ID and to not try and access the node or sub-nodes after removing them or a segmentation fault could result.

Example 1

This example removes a sub tree from a DOM.

; Parses an XML document and show all nodes.
doc_id = XmlParse('chart.xml', /File)
table = XmlEvaluate(doc_id, '//*')
; Removes part of the node tree
FOR i=0L, N_ELEMENTS(table)-1 DO PRINT, table(i)
status = XmlFreeNode(table(5).nodeid)
table = XmlEvaluate (doc_id, '//*')
; Gets a new copy of the node tree and display it
XmlDocDump, doc_id, xml, Format=2
PRINT, xml