Actually, another option, you already have that information with E4X
syntax, so this could nerdily be handled in a single line. So for
example, if you wanted to see how many nodes had an firstName attribute
with the value of "Hank" ( <mynode firstName="Hank" />) then you can do
this:
xml..*.(attribute("firstName")=="Hank").length();
Jason Merrill
Bank of America Global Learning
Learning & Performance Solutions
Join the Bank of America Flash Platform Community and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Geografiek
Sent: Friday, March 26, 2010 5:09 AM
To: Flash Coders List
Subject: Re: [Flashcoders] Counting xml attributes
Hi Theodore,
Something like (code not tested):
var counter:uint = 0;
for each (node in myXml..*) {
if(no...@myatt == givenValue) {
counter++;
}
}
trace(counter);
HTH
Willem van den Goorbergh
On 23-mrt-2010, at 14:20, Lehr, Theodore wrote:
> Is there a way to loop through xml and count how many times an
> attribute has a given value?
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
Geografiek is a Dutch, Utrecht-based map and chart design company.
Willem van den Goorbergh can be contacted by telephone: (+31)
30-2719512 or cell phone: (+31)6-26372378
or by fax: (+31)302719687
snail mail: Hooghiemstraplein 89 3514 AX UTRECHT
Visit our website at: http://www.geografiek.nl
=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders