all groups > flash (macromedia) > august 2005 >
You're in the

flash (macromedia)

group:

xml length



xml length yaniv73
8/4/2005 11:28:38 PM
flash (macromedia): hi

i have this xml:

<AdreesBook>
<Person>
<name>Yaniv Bahat</name>
<tel>917-710-1356</tel>
<email>yaniv73@gmail.com</email>
</Person>
<Person>
<name>Aviv Oranim</name>
<tel>646-557-0097</tel>
<email>aviv@vooz.com</email>
</Person>
</addressbook>

and i am running a for loop abd i want it to run with the exact numbers of th
person node ( in this case twice) but i want it to be dynamic , is there a way
to find the length of the xml?

thanks
Re: xml length yaniv73
8/4/2005 11:37:08 PM
ok found it

for(j=0;j<this.firstChild.childNodes.length;j++)

Re: xml length Rothrock
8/5/2005 12:00:00 AM
You can also look into the for...in construction.

for(var a in this.firstChild.childNode){
trace(this.firstChild.childNode[a]);
}

Re: xml length NSurveyor
8/5/2005 12:00:00 AM
One small mistake Rothrock... It's childNodes not childNode:

for(var a in this.firstChild.childNodes){
trace(this.firstChild.childNodes[a]);
Re: xml length Rothrock
8/5/2005 10:12:08 PM
AddThis Social Bookmark Button