XML_DELETE_NODE

Script function: Removes a specific XML element.

Syntax

XML_DELETE_NODE (Element)

Syntax part

Description/format

Element

Reference to the element to be deleted.
Format: script literal or script variable


 

Return code

'0' – The element has been successfully deleted.

The script element deletes a specific element from the XML document that is open. You must specify the reference to the element that you want to delete. If the specified element contains sub-elements, they too will be deleted.

Notes:

Example

The following example opens a structured Documentation tab as an XML document, captures the first element, and deletes it. A message is printed in the activation report indicating whether the deletion was successful.

SET &XMLDOCU#=XML_OPEN(DOCU,,"@Details")

:IF &XMLDOCU# <>
""
:SET &FIRST# = XML_GET_FIRST_CHILD(&XMLDOCU#)
:SET &DELETE# = XML_DELETE_NODE(&FIRST#)

:IF &DELETE# = 0
:P 'First XML element successfully deleted'
:ELSE 

: P 'An error occurred while deleting the XML element'

:ENDIF

:ENDIF
:P &XMLDOCU#

:XML_CLOSE

See also:

seealso

Script Functions for XML Elements