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. |
Notes
The script element deletes all subordinate elements of a specific element within the XML document that is open (XML_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.
The script element only copies the XML structure that is stored in the memory. The Documentation tab is not affected by this.
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:
Script element | Description |
---|---|
XML_OPEN | Opens an XML document for processing. |
:XML_CLOSE | Closes an XML document. |
Script Element – Reading or Modifying Objects
Examples
Determining the Error Message and Number
About Scripts
Script Elements – Alphabetical Listing
Script Elements – Ordered by Function