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

XML_GET_CHILD_COUNT

Script Function: Counts the sub-elements of an element

Syntax

XML_GET_CHILD_COUNT (Reference)

Syntax

Description/Format

Reference

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

Return code

Number of sub-elements

Comments

The script function determines the number of an element's sub-elements.

A handle must be given to the script function to access the element. This handle is made available by script elements which can take position within the XML document, such as XML_GET_FIRST_CHILD, XML_GET_NEXTSIBLING, XML_SELECT_NODE or XML_OPEN.

Please note that only the sub-elements that are in the next structure level may be counted. The script function does not identify an element's total number of sub-elements.

Example

The number of sub-elements ("2") is identified and output in the activation log.

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

:
SET &NR# = XML_GET_CHILD_COUNT(&XMLDOCU#)
:
PRINT "Number of sub-elements of Content: &NR#"

:
XML_CLOSE

 

See also:

Script Elements - Read or Modify Objects

Structured Documentation

www.w3c.org/TR/xmlbase

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function