XML_APPEND_ELEMENT
Use the XML_APPEND_ELEMENT script function to attach a specific element of the open XML document to another element as a sub-element. Doing so moves the element.
Important! The XML structure is modified in memory only. The changes made by XML_APPEND_ELEMENT 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_APPEND_ELEMENT (Reference element, Element)
Parameters
| Parameter | Description | Format |
|---|---|---|
| Reference element | Reference to the element to which the other element is attached as a sub-element | Script literal or script variable |
| Element | Reference to the element that is attached (and thereby moved) | Script literal or script variable |
Return Codes
The script function returns the reference to the attached element.
Examples
The following example opens the @Details structured Documentation page of the current object as an XML document. Sub-Child-C, which is located within Child2, is then attached to the first element of the XML structure (Child1).
:SET &XMLDOCU#=XML_OPEN (DOCU,,"@Details")
:IF &XMLDOCU# <> ""
: SET &FIRST# = XML_GET_FIRST_CHILD(&XMLDOCU#)
: SET &TOAPPEND# = XML_SELECT_NODE(&XMLDOCU#,"Child2/Sub-Child-C")
: SET &CLONECHILD# = XML_APPEND_ELEMENT(&FIRST#,&TOAPPEND#)
: SET &ELEMENT# = XML_GET_FIRST_CHILD(&FIRST#)
: WHILE &ELEMENT# <> ""
: SET &NAME# = XML_GET_NODE_NAME(&ELEMENT#)
: P 'Element: &NAME#'
: SET &ELEMENT# = XML_GET_NEXTSIBLING(&ELEMENT#)
: ENDWHILE
:ENDIF
:XML_CLOSE &XMLDOCU#
The activation report shows all the sub-elements that are now located within the Child1 element:
See also:

