# Xml

**URL:** <https://forum.kirupa.com/t/xml/277879>\
**Category:** Uncategorized\
**Created:** [December 18, 2008, 11:38am UTC](https://forum.kirupa.com/t/xml/277879 "2008-12-18T11:38:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IanCremona](https://avatars.discourse-cdn.com/v4/letter/i/65b543/32.png) [@IanCremona](https://forum.kirupa.com/u/IanCremona)\
**Post date:** [December 18, 2008, 11:38am UTC](https://forum.kirupa.com/t/xml/277879/1 "2008-12-18T11:38:22Z")

</div>

Why is:

```
 ActionScript Code:
 [LEFT][COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"xml..players[0] = "[/COLOR]+ [COLOR=#0000ff]xml[/COLOR]..[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];

```

[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"xml…players[0] = "[/COLOR]+ [COLOR=#0000ff]xml[/COLOR]…[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"xml…players.length() = "[/COLOR]+ [COLOR=#0000ff]xml[/COLOR]…[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]length[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR];  
[/LEFT]

Outputting :

xml…players[0] = \<players\>  
\<player\>Rosario Maij\</player\>  
\<player\>Nathanael Poysti\</player\>  
\</players\>  
xml…players[0] = \<players\>  
\<player\>Rosario Maij\</player\>  
\<player\>Nathanael Poysti\</player\>  
\</players\>  
**xml…players.length() = 1**

How can I get the total amount of \<player\> for this loop:

```
ActionScript Code:
[LEFT][COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000] **var** [/COLOR] v:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR]; v &lt; [COLOR=#000000]([/COLOR][COLOR=#0000FF]xml[/COLOR]..[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000FF]length[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR]; v++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]

[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"xml..players.player[0] == "[/COLOR]+ [COLOR=#0000FF]xml[/COLOR]..[COLOR=#000080]players[/COLOR].[COLOR=#000080]player[/COLOR][COLOR=#000000][[/COLOR]v[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];

[COLOR=#000000]}[/COLOR]

```

[/LEFT]

Thanks  
Ian

=====================================================

update:

“myXML.length() doesn’t yield the same as myArray.length. No matter how many child nodes are in your XML object, the length property will be returned as 1.”

- How may I go around this?
