XML_GET_CHILD_COUNT
Use the XML_GET_CHILD_COUNT script function to determine the number of an element's sub-elements. Only the sub-elements that are in the next structure level can be counted. XML_GET_CHILD_COUNT does not identify an element's total number of sub-elements.
Syntax
XML_GET_CHILD_COUNT (Reference)
Script Function and Parameters
-
XML_GET_CHILD_COUNT
Counts the sub-elements of an element -
Reference
Reference to the element whose number of sub-elements should be identified
Format: script literal or script variable
Tips: References or handles let you identify and edit a position within the XML document. You can use the following script functions to retrieve handles:
Return Code
This script function returns the number of sub-elements.
Example
The following example identifies the number of sub-elements of the 'Content' element available in the ON_CALL_SERVICES Calendar object and prints the result in the activation report.
:SET &XMLDOCU# = XML_OPEN (DOCU,"ON_CALL_SERVICES","@Details")
:SET &NR# = XML_GET_CHILD_COUNT(&XMLDOCU#)
:PRINT "Number of sub-elements of Content: &NR#"
:XML_CLOSE
As the 'Content' element of the ON_CALL_SERVICES Calendar object includes the two sub-elements 'Description' and 'Contacts', the number '2' is printed in the activation report:
See also: