XML_GET_FIRST_CHILD

Script Function: Identifies the first sub-element of an element

Syntax

XML_GET_FIRST_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 first sub-element
" " - There is no sub-element.

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

A handle must be given to the script function so that it can access the appropriate first sub-element. Handles are used by specific script elements for  positioning themselves within the XML document and editing it. 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_FIRST_CHILD identifies the element that is positioned one level to the right in the structure. Use XML_GET_NEXTSIBLING to identify the subsequent element on the same level. For more information, see XML_GET_NEXTSIBLING.

Example

In the following example, the name of the first sub-element of "Description" is retrieved.

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

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

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

:
XML_CLOSE

See also:

seealso

Script Functions for XML Elements