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. |
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:
- The change to the script element only affects the XML structure that is stored in the memory. The Documentation tab remains unaffected.
- 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, 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: