You're correct, but you can also do the filtering in a loop to be dynamic:

var result:XMLList = rootXML.group.(name.text().contains("fred"));
for each (filterName) { // psuedo-code
   result = result.(name.text().contains(filterName));
}
return result;

- Daniel Freiman

On Mon, Sep 22, 2008 at 10:38 AM, Mark Carter <[EMAIL PROTECTED]> wrote:

>
> Oh cool, that works, thanks very much Daniel.
>
> Am I right in thinking that "name.text()" is returning an XMLList of text
> nodes and "contains(fred)" is basically looking for a match of "fred" in
> that list?
>
> In real life, instead of having two names, I have an array of names. I
> suppose its not possible to build an e4x expression at runtime?
>
>
> Daniel Freiman wrote:
> >
> > try this:
> >
> > rootXML.group.(name.text().contains("fred") &&
> > name.text().contains("bob"))
> >
> > - Daniel Freiman
> >
> > On Mon, Sep 22, 2008 at 5:20 AM, Mark Carter <[EMAIL 
> > PROTECTED]<code%40mark.carter.name>
> >
> > wrote:
> >
> >>
> >> Ok, that subject is a bit vague but here's an example of what I mean:
> >>
> >> <group id="1">
> >> <name>fred</name>
> >> <name>bob</name>
> >> <name>peter</name>
> >> </group>
> >>
> >> Say we have lots of these group elements in an XML document. I want to
> >> select all groups including the names "fred" and "bob", for example. Is
> >> it
> >> possible in one e4x expression?
> >>
> >> My guess would be: rootXML.group.name.(text() ==
> >> "fred").parent().name.(text() == "bob").parent()
> >>
> >> but the parent() part seems to be wrong.
> >>
> >> Any ideas???
> >>
> >> On a slightly different note...
> >>
> >> I notice that rootXML.group.(name == "fred") will only work for a group
> >> containing fred and nothing else. Using rootXML.group.name.(text() ==
> >> "fred") sort of gives me what I want, but I really want the parent()
> >> elements. Of course, I could iterate over the results but I really want
> >> to
> >> do this in one expression.
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/e4x-problem---filtering-elements-based-on-multiple-child-conditions-tp19604364p19604364.html
> >> Sent from the FlexCoders mailing list archive at Nabble.com.
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/e4x-problem---filtering-elements-based-on-multiple-child-conditions-tp19604364p19609288.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>
>  
>

Reply via email to