# Counting XML nodes

**URL:** <https://forum.kirupa.com/t/counting-xml-nodes/280293>\
**Category:** Uncategorized\
**Created:** [January 25, 2009, 8:07pm UTC](https://forum.kirupa.com/t/counting-xml-nodes/280293 "2009-01-25T20:07:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![typografuk](https://avatars.discourse-cdn.com/v4/letter/t/e8c25b/32.png) [@typografuk](https://forum.kirupa.com/u/typografuk)\
**Post date:** [January 25, 2009, 8:07pm UTC](https://forum.kirupa.com/t/counting-xml-nodes/280293/1 "2009-01-25T20:07:13Z")

</div>

Some basic stuff with XML and not finding what I need online. Help appreciated.

What actionscript code will be able to determine these numerals for me and assign them to variables?

I want 1 variable to tell me how many firstChild(s?) there are \<inventors\>  
Another variable to tell me how many children each firstChild(?) has, \<person\>  
And another variable to tell me how many children each \<person\> has (name & comment)

Forgive me if my terminology is off, I feel like a dolt. If it’s not clear let me know. But I can’t figure out what code will do this. Thank so much

```auto
<?xml version="1.0"?>

<list>
<inventors>
    <person>
        <name>Thomas Edison</name>
        <comment>Inventor of many things...</comment>
    </person>
    <person>
        <name>Doug Engelbart</name>
        <comment>Invented the mouse...</comment>
    </person>
</inventors>

<inventors>
    <person>
        <name>Thomas Edison</name>
        <comment>Inventor of many things...</comment>
    </person>
</inventors>

<inventors>
    <person>
        <name>Thomas Edison</name>
        <comment>Inventor of many things...</comment>
    </person>
    <person>
        <name>Doug Engelbart</name>
        <comment>Invented the mouse...</comment>
    </person>
</inventors>

</list>

```
