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

The script function determines the number of an element's sub-elements. Only the sub-elements that are in the next structure level can be counted. The script function does not identify an element's total number of sub-elements.

Note: You must provide a handle to the script function to access the element. Use a script function that takes position within the XML document to provide the handle. The following are examples of script elements that you can use for this purpose:

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:

seealso

Script Functions for XML Elements