XML_DELETE_NODE
Use the XML_DELETE_NODE script function to delete a specific element from an open XML document. You specify a reference to the element you want to delete. Any sub-elements of the specified element are also deleted.
Important! The XML structure is modified in memory only. The changes made by XML_DELETE_NODE are not visible on the Documentation page.
Tip: Use the XML_OPEN script function to open the XML document. For more information, see XML_OPEN.
Syntax
XML_DELETE_NODE (Element)
Parameters
| Parameter | Description | Format |
|---|---|---|
| Element | Reference to the element to be deleted | Script literal or script variable |
Return Codes
| Return Value | Condition |
|---|---|
| 0 | The element was successfully deleted |
Examples
The following example opens the @Details structured Documentation page of the current object as an XML document, selects the first element, and deletes it.
: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
The activation report indicates whether the deletion was successful:
See also:
