Is there a reason to have <s> as a child node instead of an attribute?
Sorting would be a lot easier if <s> was an attribute of <p> instead of
a child node.  For example:

var myXML:XML = new XML(<all>
        <p s="dog" />
        <p s="cat" />
        <p s="bird" />
        <p s="cat" />
        <p s="sheep" />
        <p s="goat" />
        <p s="cat" />
</all>);

var myXMLList:XMLList = myXML.p.(@s == "cat");
trace(myXMLList);

Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Soluions

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: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of
Mendelsohn, Michael
Sent: Wednesday, February 03, 2010 9:47 AM
To: Flash Coders List
Subject: [Flashcoders] E4X question

Hi list...

I can't seem to get the right E4X statement.  I'm trying to get an
XMLList of all the p tags that have an s tag that is a certain string.
I've tried all sorts of combinations, thinking this one would work, but
it doesn't:
// where animal is passed "dog"
var list:XMLList = XMLList(all..p..(s.toString()==animal).parent());
or even
var list:XMLList = XMLList(all..(s.toString()==animal).parent());

Help! Thanks,
- Michael M.
 
<all>
        <p>
                <s>dog</s>
        </p>
        <p>
                <s>cat</s>
        </p>
        <p>
                <s>bird</s>
        </p>
        <p>
                <s>dog</s>
        </p>
        <p/>
</all>

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to