That is a good question. I cannot think of a way to do that with pure
e4x. Maybe someone else will.
If I needed this, I would get all the filter values:
var xlFilters:XMLList = root..filter.text();
I'd create an associative array to hold flags for the found values:
var oFoundFilters:Object = new Object();
Then I'd loop over the xml list of filter values. If the value exists
in the associative array, I'd skip it, if not, I'd add it to my unique
array.
For(var i ...
sFoundFilter = xlFilters[i]'
If(!oFoundFilters[sFoundFilter]) {
aUnique.push(sFoundFilter)
oFoundFilters[sFoundFilter] = true; //put a flag in the found array
aUnique will be an array of unique values.
Tracy Spratt
Lariat Services
Flex development bandwidth available
________________________________
From: [email protected] [mailto:[email protected]] On
Behalf Of markgoldin_2000
Sent: Thursday, January 22, 2009 6:50 PM
To: [email protected]
Subject: [flexcoders] XML Filtering
For this simple XML:
<root>
<data>
<filter>f1</filter>
<value>1</value>
</data>
<data>
<filter>f1</filter>
<value>2</value>
</data>
<data>
<filter>f2</filter>
<value>3</value>
</data>
</root>
is it possible to retrieve unique values of an element "filter"?
Thanks