Automation Engine Script Guide > Ordered by Function > Read or Modify Objects > XML_GET_FIRST_CHILD

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.

Comments

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.

With XML_GET_FIRST_CHILD, which is positioned one level to the right in the structure, XML_GET_NEXTSIBLING may be used to identify the succeeding element on the same level.

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:

Script element Description
XML_GET_LAST_CHILD Identifies the last sub-element of an element

XML_GET_NEXTSIBLING

Identifies the succeeding element

Script Elements - Read or Modify Objects

Structured Documentation

www.w3c.org/TR/xmlbase

About Scripts
Script Elements - Alphabetical Listing

Script-Elements - Ordered by Function