also, attributes() only get's me the attribute values, not the name=value pairs, how can i get both the attribute names and the values?
d. On Tue, Apr 22, 2008 at 1:43 PM, Derrick Anderson < [EMAIL PROTECTED]> wrote: > hey Alex, > > yes, there are about 10 different classes that can be called on this way, > and currently I am linking to all of them so they will be available, I'm not > using modules. > > i was more asking if there was a way to just 'cast' that xml to the class, > so i don't have to loop over the attributes- but if that's the way to go, > that will work too. > > thanks, > d. > > > On Tue, Apr 22, 2008 at 1:31 PM, Alex Harui <[EMAIL PROTECTED]> wrote: > > > Your first problem is getting the classes you want to create to be > > available. Are you going to link in every class that can possibly be used? > > Are you going to use modules to load those classes? > > > > > > > > Once you have that, you can just run through the XML, get the name() for > > the tag, use getDefinition() to get the class and make the new class, then > > get the attributes() and assign them using [] syntax. > > > > > > ------------------------------ > > > > *From:* flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] *On > > Behalf Of *Derrick Anderson > > *Sent:* Tuesday, April 22, 2008 9:33 AM > > *To:* flexcoders@yahoogroups.com > > *Subject:* [flexcoders] easiest way to instantiate a class from xml data > > > > > > > > say i have an xml node like > > > > <class property1="blah" /> > > > > what's the easiest way to convert that to: > > > > myClass = new class(); > > myClass.property1 = "blah"; > > > > i've seen it done with regular objects and VO's just by casting, but not > > with XML. > > > > this is dynamic in nature, so I'm wondering how i can convert the xml > > data to instantiated classes, any ideas? > > > > thanks, > > d. > > > > > > > >