XML_GET_LAST_CHILD 

Script function: Identifies the last sub-element of an element

Syntax

XML_GET_LAST_CHILD (Reference)

Syntax

Description/Format

Reference

Reference to the element whose sub-element is to be identified
Format: script literal or script variable


Return code

Reference to the last sub-element
" " - There is no sub-element.

The script function identifies the last sub-element of an element in an XML document.

A handle must be given to the script function so that it can access the appropriate last sub-element. This reference specifies the position in the XML document. The very first handle is the one which is returned by XML_OPEN. It refers e.g. to the root element Content of the structured documentation. For more information, see XML_OPEN.

Tip: XML_GET_LAST_CHILD switches a level deeper into the structure, starting at the specified element. Use XML_GET_NEXTSIBLING to identify the subsequent element on the same level. For more information, see XML_GET_NEXTSIBLING.

Example

The following example determines the name of the last sub-element Info with the main element "Content" being the starting point.

:SET &XMLDOCU# = XML_OPEN(DOCU,"ON_CALL","@Details")

:
SET &HND# = XML_GET_LAST_CHILD(&XMLDOCU#)

:   
IF &HND# <> ""
:      
SET &NAME# = XML_GET_NODE_NAME(&HND#)
:      
PRINT "Last sub-element: &NAME#"
:   
ELSE
:     
 PRINT "No sub-element"
:  
 ENDIF

:
XML_CLOSE

See also:

seealso

Script Functions for XML Elements