Script function: Removes a specific XML element.
Reference to the element to be deleted.
'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.
- 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.
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.
:IF &XMLDOCU# <> ""
:SET &FIRST# = XML_GET_FIRST_CHILD(&XMLDOCU#)
:SET &DELETE# = XML_DELETE_NODE(&FIRST#)
:IF &DELETE# = 0
:P 'First XML element successfully deleted'
: P 'An error occurred while deleting the XML element'