%XML_ELEM_REMOVECHILD
Remove the first child specified from an element
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
status = %XML_ELEM_REMOVECHILD(element, child_name[, child_id])
Arguments
status
XML_SUCCESS if the specified child was removed. (i4)
element
The XML element instance of the parent element. (XML_ELEM_TYPE)
child_name
The tag name of the child element to remove. (a)
child_id
(optional) The removed child element. (XML_ELEM_TYPE)
Discussion
%XML_ELEM_REMOVECHILD removes the first child with the given tag name from an XML element. If the child_id argument is specified, you are responsible for deleting memory by calling %XML_ELEM_DELETE for that child_id. If child_id is not specified, %XML_ELEM_REMOVECHILD will delete the child automatically.
If you need more control than simply removing the first child, see %XML_ELEMLIST_REMOVE. To remove all child elements, see %XML_ELEM_REMOVECHILDREN.
Examples
The example below assumes an XML element called elem has a child whose tag name is child1:
ret=%xml_elem_removechild(elem, "child1")
Or, if we want to keep the removed child element in a variable called child, we’d do this:
ret = %xml_elem_removechild(elem,"child1",child) ;If it doesn't get added to any element lists, delete it when finished: xcall xml_elem_delete(child)