[Flashcoders] E4X question: finding parent
Hi list... I'm trying to find some xml's parent attribute. I have pet name=Sugar/ and I want to find B. var pets:XML = pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] E4X question: finding parent
would help if I answer the question: childnode.parent().@group *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:42, Matt Folkard wrote: parent() should do it, as in: childnode.parent() Cheers matt *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:32, Mendelsohn, Michael wrote: Hi list... I'm trying to find some xml's parent attribute. I havepet name=Sugar/ and I want to find B. var pets:XML =pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ 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
Re: [Flashcoders] E4X question: finding parent
parent() should do it, as in: childnode.parent() Cheers matt *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:32, Mendelsohn, Michael wrote: Hi list... I'm trying to find some xml's parent attribute. I havepet name=Sugar/ and I want to find B. var pets:XML =pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ 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
Re: [Flashcoders] E4X question: finding parent
Hi Michael, how about the following (not tested): var petsList:XMLList = pets.*; var sugarDaddy:XMLList = petsList.(pet name == Sugar); trace(sugarDaddy@group); HTH Willem van den Goorbergh On 5 mei 2011, at 17:32, Mendelsohn, Michael wrote: Hi list... I'm trying to find some xml's parent attribute. I have pet name=Sugar/ and I want to find B. var pets:XML = pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= Geografiek is a Dutch, Utrecht-based map and chart design company. Willem van den Goorbergh can be contacted by telephone: (+31)30-2719512 or cell phone: (+31)6-26372378 or by fax: (+31)302719687 snail mail: Hooghiemstraplein 89 3514 AX UTRECHT Visit our website at: www.geografiek.nl twitter: @wvdgoorbergh =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+= ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] E4X question: finding parent
Perhaps [code] xml..GroupNodeName [/code] should get the parent node for ya? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] E4X question: finding parent
childnode.parent().@group Thanks, Matt. Well, I'm getting stuck on finding the correct node then. How do I find the node in the xml, given the node I have? var myPet:XML = pet name=Sugar/ I get errors with a statements like these: pets..(pet.toXMLString() == myPet.toXMLString()); pets..(* == myPet); Once I have that, then I can do the parent() method call. var pets:XML =pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
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. Kenneth Kawamoto http://www.materiaprima.co.uk/ On 05/05/2011 16:32, Mendelsohn, Michael wrote: Hi list... I'm trying to find some xml's parent attribute. I havepet name=Sugar/ and I want to find B. var pets:XML =pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ 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
Re: [Flashcoders] E4X question: finding parent
Errr, my very limited E4X knowledge now deserts me, but try: pets.pet.(@name ==Sugar).parent().@group *__ **Plastic Martians Ltd.* email: m...@plasticmartians.co.uk web:www.plasticmartians.co.uk mobile: 07763 986 485 phone: 01434 382 973 On 05/05/2011 16:50, Mendelsohn, Michael wrote: childnode.parent().@group Thanks, Matt. Well, I'm getting stuck on finding the correct node then. How do I find the node in the xml, given the node I have? var myPet:XML =pet name=Sugar/ I get errors with a statements like these: pets..(pet.toXMLString() == myPet.toXMLString()); pets..(* == myPet); Once I have that, then I can do the parent() method call. var pets:XML =pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; ___ 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
Re: [Flashcoders] E4X question: finding parent
@name - will that cause problems because name is a property of XML nodes? if it is maybe try attribute(name) instead? On 05/05/2011 16:53, Kenneth Kawamoto wrote: 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. Kenneth Kawamoto http://www.materiaprima.co.uk/ On 05/05/2011 16:32, Mendelsohn, Michael wrote: Hi list... I'm trying to find some xml's parent attribute. I havepet name=Sugar/ and I want to find B. var pets:XML =pets group=A pet name=Rover/ pet name=Buffy/ /pets pets group=B pet name=Spot/ pet name=Sugar/ /pets; I can't seem to find it. Anyone know how? Thanks, - Michael M. ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] E4X question: finding parent
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
Re: [Flashcoders] E4X question: finding parent
trace(xml.pets.pet.(toXMLString() == '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 thepet 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
Re: [Flashcoders] E4X question: finding parent
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 thepet 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
RE: [Flashcoders] E4X question: finding parent
Thanks everyone for your responses. The real xml was actually more complicated than what I posted. Is it me? Sometimes it seems that E4X solutions are difficult to figure out. The actual solution in my project is this, where rslt is an XMLList: rslt = topics..descendants(*).(contains(XML(filter))); rslt = new XMLList(rslt[0].parent()); I don't know why I had to have a parent() call on a separate line, but when I had it on one line, the first line was null. Sometimes perplexed by E4X, - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders