If you want to find the EMPLOYEE node you can do something like:

trace(staff2.EMPLOYEE.(text()[0] == "leroy").toXMLString());
trace(staff2.EMPLOYEE.(child(0) == "leroy").toXMLString());
trace(staff2.EMPLOYEE.(toString() == "leroy").toXMLString());

Kenneth Kawamoto
http://www.materiaprima.co.uk/

Ferd Berfel wrote:

hello,  newbie here...


I'm trying to understand searching xml with e4x

why does this work:

    var staff:XML = <STAFF>
         <EMPLOYEE ID="501" HIRED= "1090728000000">
            <NAME>Marco Crawley</NAME>
            <MANAGER>James Crawley</MANAGER>
            <POSITION>Designer</POSITION>
         </EMPLOYEE>
 </staff>

var results:XMLList= staff.*.(POSITION == "Designer")

and this does not?

var staff2:XML=<STAFF>
 <EMPLOYEE>fred</EMPLOYEE>
 <EMPLOYEE>bob</EMPLOYEE>
<EMPLOYEE>leroy</EMPLOYEE>
<EMPLOYEE>algernon</EMPLOYEE>
</STAFF>

 trace("find leroy: " +staff2.(EMPLOYEE=="leroy"));

but more importantly, how WOULD I find leroy?  (I know I can create a
function to loop through children, but I'm wondering how to do it within the
format describe)


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

Reply via email to