revXMLNumberOfChildren

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
revXMLNumberOfChildren(<treeID>, <startNode>, <childName> [, <depth>])
Associationsxml library
Summary

Returns the number of child nodes under the specified node in an XML tree.

Introduced2.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
treeID

The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree.

startNode

The path to the node whose child nodes you want to count.

childName

A string specifying which child nodes to count. If it is empty, all child nodes are counted. Otherwise, only child nodes whose name matches the childName are counted.

depth

The depth specifies how many generations to count. If you specify 0, only the parentNode's direct child nodes are counted, but not their child nodes. If you specify 1, the parentNode's child nodes are counted, along with their child nodes. To count all generations, specify -1 as the depth.

Example
revXMLNumberOfChildren(3,myNode,,-1)
repeat for revXMLNumberOfChildren(theTree,theNode,"Book",1) times
Values
NameTypeDescription
return

The revXMLNumberOfChildren function returns a non-negative integer.

RelatedKeyword: integer
Control Structure: function
Function: revXMLChildContents, revXMLFirstChild, revXMLChildNames
Library: XML library
Glossary: LiveCode custom library, return, XML tree, child node, Standalone Application Settings, standalone application, non-negative, node, parent node
Securitydisk
Description

Use the revXMLNumberOfChildren function to find out how many child node|child nodes a parent node has, or to find out how many of a particular kind of child nodes it has.

If the revXMLNumberOfChildren function encounters an error, it returns an error message starting with "xmlerr".

Important: The revXMLNumberOfChildren function is part of the XML library. To ensure that the function works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.

Tagstext processing