I'm not sure the filtering predicate operator will work for a variable.
I think you're going to need to do this instead:

var matches:XMLList = new XMLList();
var i:int = 0;
for each (var emp:XML in x.employee)
{
  if (emp[testVar] == testValue)
  {
    matches[i++] = emp;
  }
}

The e4x compiler is going to generate code similar to this, so I don't
think we're doing anything too inefficient here.

Matt

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of thunderstumpgesatwork
Sent: Thursday, February 09, 2006 9:41 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: e4x XML question - possible bug?

Good thought, and I saw this suggestion in another related post,
however this always returns an empty list.

Is this possibly a bug?

Do you know that this should in fact work? I have not seen any
documentation stating that it should or shouldn't.

thanks,
Thunder

--- In flexcoders@yahoogroups.com, Manish Jethani <[EMAIL PROTECTED]>
wrote:
>
> On 2/8/06, thunderstumpgesatwork <[EMAIL PROTECTED]> wrote:
> 
> > x.employee.(lastName == "McGee") // nodes with lastName "McGee"
> >
> > I need to do this dynamically.. what if I don't know the element
name
> > (the 'lastName' portion above) ? How can I substitute a String
> > variable for the 'lastName' ?
> 
> Try this:
> 
>  x.employee.([variable] == "McGee")
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links



 




--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to