This may be slightly more elegant than using toXMLString():

trace(xml.pets.pet.(contains(<pet name="Sugar"/>)).parent().@group);

// B

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

On 05/05/2011 17:06, Mendelsohn, Michael wrote:
Thanks everyone.

I don't want to find the<pet>  node by using just @name.  I need to match a 
node in xml.pets, given a full node, like so:
xml.pets.(pet.toXMLString() == myPet.toXMLString());

I can't seem to get part that working.

I think it should be easy to use parent() once I have that bit, right?

- Michael M.



-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com 
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Kenneth Kawamoto
Sent: Thursday, May 05, 2011 11:54 AM
To: flashcoders@chattyfig.figleaf.com
Subject: Re: [Flashcoders] E4X question: finding parent

var xml:XML =<root>
<pets group="A">
<pet name="Rover"/>
<pet name="Buffy"/>
</pets>
<pets group="B">
<pet name="Spot"/>
<pet name="Sugar"/>
</pets>
</root>;

trace(xml.pets.pet.(@name == "Sugar").parent().@group);

// B

Perhaps you don't want to call your XML "pets" as it's a node name as well.
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to