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:* [email protected] [mailto:[EMAIL PROTECTED] *On
> Behalf Of *Derrick Anderson
> *Sent:* Tuesday, April 22, 2008 9:33 AM
> *To:* [email protected]
> *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.
>
>  
>

Reply via email to