RE: [Flashcoders] Querying XML
I am trying: buildXML = peopleXML.person.(@group == dd_group.value.toString()) peopleXML.person.(@room == dd_room.value.toString()); but it only seem to pick up the last condition - how can I get multiple conditions in? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Taka Kojima [t...@gigafied.com] Sent: Thursday, August 05, 2010 3:08 PM To: Flash Coders List Subject: Re: [Flashcoders] Querying XML E4X is a much better approach than looping through an XML object and adding items to an XMLList. An E4x command automatically returns an XMLList type object. On Thu, Aug 5, 2010 at 11:47 AM, Nathan Mynarcik nat...@mynarcik.comwrote: You would need to make a var that is an XMLList that pulls only the nodes that have the value a. Then you can trace out your XMLList and it will only be the ones you need. Nathan Mynarcik nat...@mynarcik.com 254.749.2525 www.mynarcik.com On Thu, Aug 5, 2010 at 2:18 PM, Lehr, Theodore ted_l...@federal.dell.com wrote: Is there a way to only show certain xml based on a value - for instance - say I have: var aXML:XML = root item title=1 value=a/ item title=2 value=a/ item title=3 value=a/ item title=4 value=b/ item title=5 value=b/ /root So if someone picks a from a drop down - I would then only display the ones that have the value of a in a datagrid... I am used to just doing something like: var myDP:DataProvider = new DataProvider(aXML); How can I remove xml members or keep them from being shown? ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Querying XML
Lehr, Theodore wrote: I am trying: buildXML = peopleXML.person.(@group == dd_group.value.toString()) peopleXML.person.(@room == dd_room.value.toString()); I am surprised that it even returns an XMLList, wait, does it? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] Querying XML
it does - based on the last condition How can I query the xml using multiple conditions? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson [he...@henke37.cjb.net] Sent: Friday, August 06, 2010 12:40 PM To: Flash Coders List Subject: Re: [Flashcoders] Querying XML Lehr, Theodore wrote: I am trying: buildXML = peopleXML.person.(@group == dd_group.value.toString()) peopleXML.person.(@room == dd_room.value.toString()); I am surprised that it even returns an XMLList, wait, does it? ___ 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] Querying XML
First of all: Henrik, why rewrite core functionality? E4X is a standard, telling him to write his own loop for data is something that I strongly disagree with. The only case where I can see writing your own loops for XML would be beneficial would be if you really had a performance issue and needed to optimize and even then, unless you are making 100+ E4X calls would it really make a difference... maybe. Do your own loop and don't relay on a syntax feature that hides the loop from you. Does that mean we should all start rewriting code that's part of the core library so that we don't rely on anything we didn't write ourselves? Because that is essentially what you are suggesting. Theodore, I'm sure you could have googled something like E4X multiple conditions and found the answer to your question in a couple of minutes, but anyway, you handle multiple conditions with something like the following: peopleXML.person.(@group == dd_group.value.toString() @room == dd_room.value.toString()); You could also do an or instead of an and (||). Taka On Fri, Aug 6, 2010 at 9:46 AM, Lehr, Theodore ted_l...@federal.dell.comwrote: it does - based on the last condition How can I query the xml using multiple conditions? From: flashcoders-boun...@chattyfig.figleaf.com [ flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson [ he...@henke37.cjb.net] Sent: Friday, August 06, 2010 12:40 PM To: Flash Coders List Subject: Re: [Flashcoders] Querying XML Lehr, Theodore wrote: I am trying: buildXML = peopleXML.person.(@group == dd_group.value.toString()) peopleXML.person.(@room == dd_room.value.toString()); I am surprised that it even returns an XMLList, wait, does it? ___ 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] Querying XML
Hi, I guess you might have solved this for now - for future reference, I have found the following 2 sources invaluable links when doing e4x stuff... http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/ (It's JavaScript / HTML, but it is a better / fuller implementation than the BetaBong one http://blog.betabong.com/showcase/e4x/E4X_Parse_Test.html) http://dispatchevent.org/roger/as3-e4x-rundown/ - invaluable article. As an aside / example of XML e4x - I found the real power of this system recently. I had been using an XML config file as a data model to configure my interface - my Application loads XML, creates Screens with each screen tag in config and each Screen created Buttons with each button tag. When asked to create a CMS, I created an Editor class to modify the button XML in the Buttons - because this XML had been passed by reference by looping through the main config file, changing the button xml is actually reflected in the config - i.e. I could resave the XML file by dumping the config XMl which has all the edits. For me, that's the big clincher which makes all this XML e4x totally worthwhile - of course you can do it with other data types, but XML is editable by anyone with half a brain so it's a happy medium and once you get past some of the quirks, it's not bad to work with and saves coding up model classes for simple projects, etc. HTH a little Glen Lehr, Theodore wrote: it does - based on the last condition How can I query the xml using multiple conditions? From: flashcoders-boun...@chattyfig.figleaf.com [flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Henrik Andersson [he...@henke37.cjb.net] Sent: Friday, August 06, 2010 12:40 PM To: Flash Coders List Subject: Re: [Flashcoders] Querying XML Lehr, Theodore wrote: I am trying: buildXML = peopleXML.person.(@group == dd_group.value.toString()) peopleXML.person.(@room == dd_room.value.toString()); I am surprised that it even returns an XMLList, wait, does it? ___ 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
[Flashcoders] Querying XML
Is there a way to only show certain xml based on a value - for instance - say I have: var aXML:XML = root item title=1 value=a/ item title=2 value=a/ item title=3 value=a/ item title=4 value=b/ item title=5 value=b/ /root So if someone picks a from a drop down - I would then only display the ones that have the value of a in a datagrid... I am used to just doing something like: var myDP:DataProvider = new DataProvider(aXML); How can I remove xml members or keep them from being shown? ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Querying XML
You would need to make a var that is an XMLList that pulls only the nodes that have the value a. Then you can trace out your XMLList and it will only be the ones you need. Nathan Mynarcik nat...@mynarcik.com 254.749.2525 www.mynarcik.com On Thu, Aug 5, 2010 at 2:18 PM, Lehr, Theodore ted_l...@federal.dell.comwrote: Is there a way to only show certain xml based on a value - for instance - say I have: var aXML:XML = root item title=1 value=a/ item title=2 value=a/ item title=3 value=a/ item title=4 value=b/ item title=5 value=b/ /root So if someone picks a from a drop down - I would then only display the ones that have the value of a in a datagrid... I am used to just doing something like: var myDP:DataProvider = new DataProvider(aXML); How can I remove xml members or keep them from being shown? ___ 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] Querying XML
Look into e4x To only show items with value=a it would be aXML.item.(@value == a) On Thu, Aug 5, 2010 at 11:18 AM, Lehr, Theodore ted_l...@federal.dell.comwrote: Is there a way to only show certain xml based on a value - for instance - say I have: var aXML:XML = root item title=1 value=a/ item title=2 value=a/ item title=3 value=a/ item title=4 value=b/ item title=5 value=b/ /root So if someone picks a from a drop down - I would then only display the ones that have the value of a in a datagrid... I am used to just doing something like: var myDP:DataProvider = new DataProvider(aXML); How can I remove xml members or keep them from being shown? ___ 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] Querying XML
E4X is a much better approach than looping through an XML object and adding items to an XMLList. An E4x command automatically returns an XMLList type object. On Thu, Aug 5, 2010 at 11:47 AM, Nathan Mynarcik nat...@mynarcik.comwrote: You would need to make a var that is an XMLList that pulls only the nodes that have the value a. Then you can trace out your XMLList and it will only be the ones you need. Nathan Mynarcik nat...@mynarcik.com 254.749.2525 www.mynarcik.com On Thu, Aug 5, 2010 at 2:18 PM, Lehr, Theodore ted_l...@federal.dell.com wrote: Is there a way to only show certain xml based on a value - for instance - say I have: var aXML:XML = root item title=1 value=a/ item title=2 value=a/ item title=3 value=a/ item title=4 value=b/ item title=5 value=b/ /root So if someone picks a from a drop down - I would then only display the ones that have the value of a in a datagrid... I am used to just doing something like: var myDP:DataProvider = new DataProvider(aXML); How can I remove xml members or keep them from being shown? ___ 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] Querying XML
I agree, and you can do a for loop to display your data. On Thu, Aug 5, 2010 at 3:08 PM, Taka Kojima t...@gigafied.com wrote: E4X is a much better approach than looping through an XML object and adding items to an XMLList. An E4x command automatically returns an XMLList type object. On Thu, Aug 5, 2010 at 11:47 AM, Nathan Mynarcik nat...@mynarcik.com wrote: You would need to make a var that is an XMLList that pulls only the nodes that have the value a. Then you can trace out your XMLList and it will only be the ones you need. Nathan Mynarcik nat...@mynarcik.com 254.749.2525 www.mynarcik.com On Thu, Aug 5, 2010 at 2:18 PM, Lehr, Theodore ted_l...@federal.dell.com wrote: Is there a way to only show certain xml based on a value - for instance - say I have: var aXML:XML = root item title=1 value=a/ item title=2 value=a/ item title=3 value=a/ item title=4 value=b/ item title=5 value=b/ /root So if someone picks a from a drop down - I would then only display the ones that have the value of a in a datagrid... I am used to just doing something like: var myDP:DataProvider = new DataProvider(aXML); How can I remove xml members or keep them from being shown? ___ 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 ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Querying XML
Taka Kojima wrote: E4X is a much better approach than looping through an XML object and adding items to an XMLList. In this case, yes. But only because it will end up being the same code that you would have written anyway. The condition syntax is nothing but an inline search loop. And the loop doesn't stop at the first match. So if you just want the first match or want to search from a specific offset, do your own loop and don't relay on a syntax feature that hides the loop from you. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders