Argh..now I'm having difficulty using this variable in an e4x 
filtering expression. 

here was my old code that worked fine with a named value

var myXMLList:XMLList = xl.(EmployeeId == _selectedRowID);      

Now, I know that I can use the variable name to refer to an XML node 
like so:

myXMLList[id]  // returns <EmployeeID>  id is my variable name

But when I try to use the variable name id in this filtering 
expression, it is not working.

I've tried:

var myXMLList:XMLList = xl.([id] ==_selectedRowID);

and 


var myXMLList:XMLList = xl([id] ==_selectedRowID);      //error - 
thinks it's a method call

So how do you filter e4x using a variable name?

Thanks



--- In [email protected], "guitarguy555" <[EMAIL PROTECTED]> 
wrote:
>
> Thanks guys! That's exactly what I needed.
> 
> Cheers
> 
> --- In [email protected], "vardpenguin" <martine@> wrote:
> >
> > 
> > once you've nagivated to the node you're wanting to look at you 
can
> > use name().localName:
> > 
> > once example might be:
> > var nodeName : String = XML(books.book[0]).name().localName;
> > 
> > 
> > 
> > 
> > --- In [email protected], "guitarguy555" <djohnson29@> 
> wrote:
> > >
> > > I have a component that has a datagrid that is bound to an 
> XMLList.
> > > 
> > > I want to be able to extract the ID column of the grid but not 
> > > specifically hardcode the name of the XML node inside the 
> component's 
> > > code.  Sometimes this ID node value will be named differently.
> > > 
> > > eg.  <EmployeeID>, or <ManagerID>
> > > 
> > > I can parse an XMLList to get the value of the ID like so:
> > > 
> > > row = myXMLList[0];
> > > var ID:String = myXMLList.(EmployeeID == _selectedRowID)); 
> > > 
> > > But instead of specifically naming "EmployeeID" inside the 
> component, 
> > > I would like to use a variable name here.
> > > 
> > > What is the e4x syntax to extract a node name instead of it's 
> > > contents?
> > >
> >
>


Reply via email to