Remove the first child specified from an element

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
status = %XML_ELEM_REMOVECHILD(element, child_name[, child_id]) 



XML_SUCCESS if the specified child was removed. (i4)


The XML element instance of the parent element. (XML_ELEM_TYPE)


The tag name of the child element to remove. (a)


(optional) The removed child element. (XML_ELEM_TYPE)


%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.


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)