XML_REMOVE_CHILDREN
Use the XML_REMOVE_CHILDREN script function to delete all subordinate elements of a specific open element within the XML document. XML_REMOVE_CHILDREN returns code 0 once the sub-elements are successfully deleted.
Important! The XML structure is modified in the memory only. You do not see the changes of XML_REMOVE_CHILDREN on the structured documentation page.
Tip: Use the XML_OPEN script function to open the XML document. For more information, see XML_OPEN.
Syntax
XML_REMOVE_CHILDREN (Element)
Script Function and Parameters
-
XML_REMOVE_CHILDREN
Removes all the sub-elements of an XML element. -
Element
Reference to the element whose sub-element will be deleted.
Format: script literal or script variable
Return Code
-
0
All sub-elements of the specified element were successfully deleted.
Example
The following example opens a structured documentation page as an XML document. The first element is specified and all of its sub-elements are deleted. If the deletion is successful, a corresponding message is written to the activation log.
:SET &XMLDOCU#=XML_OPEN(DOCU,,"@Details")
:IF &XMLDOCU# <> ""
:SET &FIRST# = XML_GET_FIRST_CHILD(&XMLDOCU#)
:SET &RET# = XML_REMOVE_CHILDREN(&FIRST#)
:IF &RET# = 0
:P 'Sub-element successfully deleted.'
:ENDIF
:ENDIF
:XML_CLOSE &XMLDOCU#
See also: