Script function: Removes a specific XML element.
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 (XML_OPEN). Reference to the element to be deleted needs to be specified.
If an element that contains sub-elements is entered, they 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.
The following example opens a structured Documentation tab as an XML document, captures the first element, and then deletes it. A message will be output 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 ]><span class="scriptstring">'An error occurred while deleting the XML element'</span><br />:<span class="scriptstatement">ENDIF</span></span><span class="script"><br /></span><span class="script"><br />:<span class="scriptstatement">ENDIF </span></span><br /> <br /><span class="script">:<span class="scriptstatement">XML_CLOSE </span><![CDATA[ &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 the Script
Script Elements – Alphabetical Listing
Script Elements – Ordered by Function