You should be able to index children of the same type as array elements.

root.accesscode.(@id == "S000").[0] or similar.

Martin Tremblay wrote:
EX4 cannot find a node using E4X when one of it's sibling has the same
name.

Is there a way to avoid this problem ?


var xmlData:XML = <root> <accesscode id="S001">
           <shortcut>S001</shortcut>
           <shortcut>smallbusiness</shortcut>
     </accesscode>
<accesscode id="S000">
           <shortcut>S000</shortcut>
           <shortcut2>S000</shortcut2>
     </accesscode>

</root>;


trace(xmlData.accesscode.(@id == "S000"));
trace("-------------");
trace(xmlData.accesscode.(shortcut == "S000"));
trace("-------------");

trace(xmlData.accesscode.(@id == "S001"));
trace("-------------");
trace(xmlData.accesscode.(shortcut == "S001"));
trace("-------------");

Martin T.
LVL



_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



--

Glen Pike
01736 759321
www.glenpike.co.uk <http://www.glenpike.co.uk>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to