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