XML_REMOVE_CHILDREN
Script function: Removes all the sub-elements of an XML element.
Syntax
XML_REMOVE_CHILDREN (Element)
Syntax part |
Description/format |
---|---|
Element |
Reference to the element whose sub-element will be deleted. |
Return code |
---|
'0' – All sub-elements of the specified element were successfully deleted. |
The script element deletes all subordinate elements of a specific element within the XML document that is open. The reference to the element needs to be specified. The script element delivers the return code '0' once the sub-element has been successfully deleted.
Notes:
- The XML structure will only copy the XML structure that is stored in the memory. The script element does not have an effect on the Documentation tab.
- Use the XML_OPEN script function to open the XML document. For more information, see XML_OPEN.
Example
The following example opens a structured Documentation tab as an XML document. The first element is then 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: