[flexcoders] Re: Create XML List by code
Be sure to have a read through: http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_04.html It covers most things you will need in dealing with XML.
Re: [flexcoders] Re: Create XML List by code
I think you can get an xml object from your xmllist and then use XML methods, most of them returns xmllist. thomas 2009/4/10 lehaianh1986 lehaianh1...@yahoo.com No, I can't use static string. Depend on my data, I will use regexp to sort and classify items to some groups (like example I show). I think it like a dynamic tree and can be add or edit, etc... So how do I do to create each element and add to XMLList, then add another element to become children of the previous element? --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Alex Harui aha...@... wrote: Create the equivalent string, then pass that into the constructor of XMLList Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com [mailto: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com] On Behalf Of lehaianh1986 Sent: Thursday, April 09, 2009 2:33 AM To: flexcoders@yahoogroups.com flexcoders%40yahoogroups.com Subject: [flexcoders] Create XML List by code Hi all, I have XMLList like: mx:XMLList id=treeData node label=Mail Box node label=Inbox node label=Marketing/ node label=Product Management/ node label=Personal/ /node node label=Outbox node label=Professional/ node label=Personal/ /node node label=Spam/ node label=Sent/ /node /mx:XMLList But I want to create XML List by code, so how do I do? -- http://www.web-attitude.fr/ msn : thomas.parqu...@web-attitude.fr softphone : sip:webattit...@ekiga.net sip%3awebattit...@ekiga.net téléphone portable : +33601 822 056
RE: [flexcoders] Re: Create XML List by code
First, just build XML then use e4x expressions to return the XMLList that you want. Create the equivalent string does not mean static. You can dynamically build your string that represents XML, using whatever run-time logic you need, the pass that string to the top-level XML() function, which returns XML. Alternatively, you can instantiate an XML node root, then use the XML API to manipulate it: var sMyVar:String = attributevalue; var xml:XML = myroot; var xmlNewNode:XML; xmlNewNode = node attrName={sMyVar} ; xml.appendChild(xmlNewNode); etc. Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of thomas parquier Sent: Friday, April 10, 2009 11:47 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Create XML List by code I think you can get an xml object from your xmllist and then use XML methods, most of them returns xmllist. thomas 2009/4/10 lehaianh1986 lehaianh1986@ mailto:lehaianh1...@yahoo.com yahoo.com No, I can't use static string. Depend on my data, I will use regexp to sort and classify items to some groups (like example I show). I think it like a dynamic tree and can be add or edit, etc... So how do I do to create each element and add to XMLList, then add another element to become children of the previous element? --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Alex Harui aha...@... wrote: Create the equivalent string, then pass that into the constructor of XMLList Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe. http://www.adobe.com/ com/ Blog: http://blogs. http://blogs.adobe.com/aharui adobe.com/aharui From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of lehaianh1986 Sent: Thursday, April 09, 2009 2:33 AM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com Subject: [flexcoders] Create XML List by code Hi all, I have XMLList like: mx:XMLList id=treeData node label=Mail Box node label=Inbox node label=Marketing/ node label=Product Management/ node label=Personal/ /node node label=Outbox node label=Professional/ node label=Personal/ /node node label=Spam/ node label=Sent/ /node /mx:XMLList But I want to create XML List by code, so how do I do? -- http://www.web- http://www.web-attitude.fr/ attitude.fr/ msn : thomas.parquier@ mailto:thomas.parqu...@web-attitude.fr web-attitude.fr softphone : sip:webattitude@ mailto:sip%3awebattit...@ekiga.net ekiga.net téléphone portable : +33601 822 056
[flexcoders] Re: Create XML List by code
Thank all of you, now I see how to build each XML element that I want. Hai Anh --- In flexcoders@yahoogroups.com, Tracy Spratt tspr...@... wrote: First, just build XML then use e4x expressions to return the XMLList that you want. Create the equivalent string does not mean static. You can dynamically build your string that represents XML, using whatever run-time logic you need, the pass that string to the top-level XML() function, which returns XML. Alternatively, you can instantiate an XML node root, then use the XML API to manipulate it: var sMyVar:String = attributevalue; var xml:XML = myroot; var xmlNewNode:XML; xmlNewNode = node attrName={sMyVar} ; xml.appendChild(xmlNewNode); etc. Tracy Spratt, Lariat Services, development services available _ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of thomas parquier Sent: Friday, April 10, 2009 11:47 AM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Re: Create XML List by code I think you can get an xml object from your xmllist and then use XML methods, most of them returns xmllist. thomas 2009/4/10 lehaianh1986 lehaianh1986@ mailto:lehaianh1...@... yahoo.com No, I can't use static string. Depend on my data, I will use regexp to sort and classify items to some groups (like example I show). I think it like a dynamic tree and can be add or edit, etc... So how do I do to create each element and add to XMLList, then add another element to become children of the previous element? --- In flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com, Alex Harui aharui@ wrote: Create the equivalent string, then pass that into the constructor of XMLList Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe. http://www.adobe.com/ com/ Blog: http://blogs. http://blogs.adobe.com/aharui adobe.com/aharui From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com [mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com] On Behalf Of lehaianh1986 Sent: Thursday, April 09, 2009 2:33 AM To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com Subject: [flexcoders] Create XML List by code Hi all, I have XMLList like: mx:XMLList id=treeData node label=Mail Box node label=Inbox node label=Marketing/ node label=Product Management/ node label=Personal/ /node node label=Outbox node label=Professional/ node label=Personal/ /node node label=Spam/ node label=Sent/ /node /mx:XMLList But I want to create XML List by code, so how do I do? -- http://www.web- http://www.web-attitude.fr/ attitude.fr/ msn : thomas.parquier@ mailto:thomas.parqu...@... web-attitude.fr softphone : sip:webattitude@ mailto:sip%3awebattit...@... ekiga.net téléphone portable : +33601 822 056
[flexcoders] Re: Create XML List by code
No, I can't use static string. Depend on my data, I will use regexp to sort and classify items to some groups (like example I show). I think it like a dynamic tree and can be add or edit, etc... So how do I do to create each element and add to XMLList, then add another element to become children of the previous element? --- In flexcoders@yahoogroups.com, Alex Harui aha...@... wrote: Create the equivalent string, then pass that into the constructor of XMLList Alex Harui Flex SDK Developer Adobe Systems Inc.http://www.adobe.com/ Blog: http://blogs.adobe.com/aharui From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of lehaianh1986 Sent: Thursday, April 09, 2009 2:33 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Create XML List by code Hi all, I have XMLList like: mx:XMLList id=treeData node label=Mail Box node label=Inbox node label=Marketing/ node label=Product Management/ node label=Personal/ /node node label=Outbox node label=Professional/ node label=Personal/ /node node label=Spam/ node label=Sent/ /node /mx:XMLList But I want to create XML List by code, so how do I do?