XML.Count

number XML.Count ( 

string XMLPath,

string ElementName )

Example 1

-- This example assumes the sample XML is already loaded into memory.
-- Count the total number of elements in "database".
count = XML.Count("database", "*");

-- Display the count in a dialog message if no errors occurred.
if (count ~= -1) then
    Dialog.Message("Count", "There are "..count.." elements in the database.");
end

Counts the total number of elements in "database" and shows the result in a dialog message.

Example 2

-- This example assumes the sample XML is already loaded into memory.
-- Count the number of "phone" elements in the first customer element.
count = XML.Count("database/customer", "phone");

-- Display the count in a dialog message if no errors occurred.
if (count ~= -1) then
    Dialog.Message("Count", "There are "..count.." phone elements in the first customer element.");
end

Counts the number of "phone" elements in the first customer element and shows the result in a dialog message.

See also:  Related Actions