Class object from XML.

Hi.
I want to create DataGrid with itemReneder for each column.
This is inline generated itemRenderer:
DataGridColumn.itemRenderer = new
ClassFactory(MyCustomClass);
// MyCustomClass - it manually generated class which contains
some form items(TextInput, Combox..e.t.c.)
I want to consturct ItemRenderer dynamicly. For this i need
to create Class object and send it to itemRenderer:
var component:DynamicFormClass = new DynamicFormClass();
var newComponent:Class =
component.someMethodWhichWillCreateForm(configData); // - this will
return Class which will generate form items that described in
configData
DatagridColumn.itemRenderer = new ClassFactory(newComponent);
This code is how i see solvetion of this problem, but this
doesnt work.
I really don't know how it to create and will be very
thankful for any dicision and answers how to make it.
Thank you.

"Dmitry Sergeev" <[email protected]> wrote
in message
news:g8eghj$881$[email protected]..
> Hi.
> I want to create DataGrid with itemReneder for each
column.
>
> This is inline generated itemRenderer:
> DataGridColumn.itemRenderer = new
ClassFactory(MyCustomClass);
> // MyCustomClass - it manually generated class which
contains some form
> items(TextInput, Combox..e.t.c.)
>
> I want to consturct ItemRenderer dynamicly. For this i
need to create
> Class
> object and send it to itemRenderer:
> var component:DynamicFormClass = new DynamicFormClass();
> var newComponent:Class =
> component.someMethodWhichWillCreateForm(configData);
> // - this will return Class which will generate form
items that described
> in
> configData
> DatagridColumn.itemRenderer = new
ClassFactory(newComponent);
Use getDefinitionByName and ClassFactory to dynamically
create your class.
Just be sure that you actually have at least one "hard"
reference to each
class you intend to use, or the class might not get compiled
into your swf.
Here's a full write-up of how to do that:
http://www.paulofierro.com/archives/520/
HTH;
Amy

Similar Messages

  • Error editing task sequence: Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" From XML into WMI

    I've started getting an intermittent error editing my Windows 7 OSD task sequence.  Sometimes I can open the TS to edit, but when I try to apply changes I get the error.  Other times I get the error when trying to open the TS.  If I try again
    right away, I still get the error, but if I wait a few minutes and try again sometimes it will open the TS. 
    The error reads:
    ConfigMgr Error Object:instance of SMS_Extended Status{Description = "Failed to load dynamic properties for class \"SMS_TaskSequence_ApplyWindowsSettingsAction\" from XML into WMI";Error Code = 2147943746;File = "e:\\qfe\\nts\\sms\\siteserver\\sdk_provider\\smsprov\\ssptspackage.cpp";Line = 3454;Operation = "ExecMethod";ParameterInfo = "SMS_TaskSequencePackage";ProviderName = "WinMgmt";StatusCode = 2147749889;}
    Coinciding with this error, I show the following entries in the TaskSequenceProvider.log file: 
    [PID: 7608] Invoking method SMS_TaskSequence.LoadFromXml
    TaskSequenceProvider
    Failed to protect memory buffer, hr=0x80070542
    TaskSequenceProvider
    Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" from XML into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load node Apply Windows Settings from XML into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "PostInstall" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "Execute Task Sequence" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load children steps for node "" from XML 0x80070542 (2147943746)
    TaskSequenceProvider
    Failed to load XML for the task sequence into WMI 0x80070542 (2147943746)
    TaskSequenceProvider
    [PID: 7608] Done with method SMS_TaskSequence.LoadFromXml
    TaskSequenceProvider
    Setting status complete:  status code = 0x80070542; Failed to load dynamic properties for class "SMS_TaskSequence_ApplyWindowsSettingsAction" from XML into WMI
    TaskSequenceProvider
    I exported the task sequence and checked in "object.xml" for the "ApplyWindowsSettingsAction", to see if there was something odd in the xml, but I don't find anything that jumps out as being wrong.  Here's the section of XML for
    that step.  I've removed identifying info, and replaced it with a generic term in bold.
    <step type="SMS_TaskSequence_ApplyWindowsSettingsAction" name="Apply Windows Settings" description="" runIn="WinPE" successCodeList="0" runFromNet="false"><action>osdwinsettings.exe /config</action><defaultVarList><variable name="OSDLocalAdminPassword" property="AdminPassword"></variable><variable name="OSDComputerName" property="ComputerName">%_SMSTSMachineName%</variable><variable name="OSDProductKey" property="ProductKey"></variable><variable name="OSDRandomAdminPassword" property="RandomAdminPassword">false</variable><variable name="OSDRegisteredOrgName" property="RegisteredOrgName">COMPANY NAME</variable><variable name="OSDRegisteredUserName" property="RegisteredUserName">COMPANY NAME</variable><variable name="OSDServerLicenseConnectionLimit" property="ServerLicenseConnectionLimit">5</variable><variable name="OSDTimeZone" property="TimeZone">Central Standard Time</variable></defaultVarList></step><step type="SMS_TaskSequence_ApplyNetworkSettingsAction" name="Apply Network Settings" description="" runIn="WinPEandFullOS" successCodeList="0" runFromNet="false"><action>osdnetsettings.exe configure</action><defaultVarList><variable name="OSDDomainName" property="DomainName">DOMAIN.COM</variable><variable name="OSDJoinPassword" property="DomainPassword"></variable><variable name="OSDJoinAccount" property="DomainUsername">DOMAIN ACCOUNT</variable><variable name="OSDEnableTCPIPFiltering" property="EnableTCPIPFiltering" hidden="true">false</variable><variable name="OSDNetworkJoinType" property="NetworkJoinType">0</variable><variable name="OSDAdapterCount" property="NumAdapters" hidden="true">0</variable></defaultVarList></step>
    Is there any other log I should check for a clue on this issue?  What could be causing this error?

    Thanks for sharing that!  I tend to save contacting MS support until after I've exhausted other options.  I'm always afraid that I'll spend the $500 to open a case and then it turns out to be something simple that I would have found if I had just
    kept working on it myself a little longer.
    It looks like that link is for an update released in February as KB3023562.  I downloaded and installed it. I'll try opening/editing/saving the task sequence a few times today to see if the issue is resolved.  
    After I had already installed it, I thought to look up that update in configmgr.  The update is listed as superseded by 2 other updates.  The newest of those is KB3046049, which just installed last night with the other March patches, so it's possible
    that I didn't need to install KB3023562 after all.  

  • Dynamically create Value Objects from XML file

    Hi
    I want to create a value object from Xml file dynamically,like in the xml file i have the name of the variable and the datatype of the variable.is it possible do that,if so how.

    Read about apache's Digester tool. This is part of the Jakartha project. This tool helps in creating java objects from the XML files. I am not sure, if that is what u r looking for.

  • Create Class objects from an Array of File Objects

    Hi There,
    I'm having extreme difficulty in trying to convert an array of file objects to Class objects. My problem is as follows: I'm using Jfilechooser to select a directory and get an array of files of which are all .class files. I want to create Class objects from these .class files. Therefore, i can extract all the constructor, method and field information. I eventually want this class information to display in a JTree. Very similar to the explorer used in Netbeans. I've already created some code below, but it seems to be throwing a NoSuchMethodError exception. Can anyone please help??
    Thanks in advance,
    Vikash
    /* the following is the class im using */
    class FileClassLoader extends ClassLoader {
    private File file;
    public FileClassLoader (File ff) {
    this.file = ff;
    protected synchronized Class loadClass() throws ClassNotFoundException {
    Class c = null;
    try {
    // Get size of class file
    int size = (int)file.length();
    // Reserve space to read
    byte buff[] = new byte[size];
    // Get stream to read from
    FileInputStream fis = new FileInputStream(file);
    DataInputStream dis = new DataInputStream (fis);
    // Read in data
    dis.readFully (buff);
    // close stream
    dis.close();
    // get class name and remove ".class"
    String classname = null;
    String filename = file.getName();
    int i = filename.lastIndexOf('.');
    if(i>0 && i<filename.length()-1) {
    classname = filename.substring(0,i);
    // create class object from bytes
    c = defineClass (classname, buff, 0, buff.length);
    resolveClass (c);
    } catch (java.io.IOException e) {
    e.printStackTrace();
    return c;
    } // end of method loadClass
    } // end of class FileClassLoader
    /* The above class is used in the following button action in my gui */
    /* At the moment im trying to output the data to standard output */
    private void SelectPackage_but2ActionPerformed(java.awt.event.ActionEvent evt) {
    final JFileChooser f = new JFileChooser();
    f.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    int rVal = f.showOpenDialog(Remedy.this);
    // selects directory
    File dir = f.getSelectedFile();
    // gets a list of files within the directory
    File[] allfiles = dir.listFiles();
    // for loop to filter out all the .class files
    for (int k=0; k < allfiles.length; k++) {
    if (allfiles[k].getName().endsWith(".class")) {
    try {
    System.out.println("File name: " + allfiles[k].getName()); // used for debugging
    FileClassLoader loader = new FileClassLoader(allfiles[k]);
    Class cl = loader.loadClass();
    //Class cl = null;
    Class[] interfaces = cl.getInterfaces();
    java.lang.reflect.Method[] methods = cl.getDeclaredMethods();
    java.lang.reflect.Field[] fields = cl.getDeclaredFields();
    System.out.println("Class Name: " + cl.getName());
    //print out methods
    for (int m=0; m < methods.length; m++) {
    System.out.println("Method: " + methods[m].getName());
    // print out fields
    for (int fld=0; fld < fields.length; fld++) {
    System.out.println("Field: " + fields[fld].getName());
    } catch (Exception e) {
    e.printStackTrace();
    } // end of if loop
    } // end of for loop
    packageName2.setText(dir.getPath());
    }

    It's throwing the exeption on the line:
    FileClassLoader loader = new FileClassLoader(allfiles[k]);
    I'm sure its something to do with the extended class i've created. but i cant seem to figure it out..
    Thanks if you can figure it out

  • Load object from xml

    Imagine if you can that I have a XmlLoader class for each object that can be loaded from xml.
    Before I had the xmlLoader code inside the objects but it's better to separate loading from actual object...
    these xmlLoaders needs to be able to set all vars for those objects. How would be the best way to do that?
    Atm I have made all vars with a package scope. but this really opens the object open to all other objects in that package...
    I don't know any other options. so how do you keep your vars safe, but still be able to load them from whatever source(xml, txt)...?

    Apache Digester is good for this sort of thing. It uses setter methods to populate your objects. You could also just use XML Serialization and deserialization. Or, you could go for something like JAXB or XMLBeans, whereby you actually will have classes generated for you from XML Schemas, and instances of those classes can marshall and unmarshall themselves quite easily

  • How To Generate Objects From XML and DTD?

    Are there tools to generate objects from dtd's and xml files?
    If this is not possible for some reason: is there a tool to generate classes from a dtd?
    I can not find the "XML Java Class Generator" (from oracle) anymore.

    XMLBeans
    There are other solutions, but I know this one is pretty good.

  • Create value object from xml

    So I've got a value object with 100 fields.
    I have a ASP.net web service that returns the value objects
    as XML (I really don't want to use WebOrb...).
    I don't want to write a lot of code like this:
    vo.Field1 = voXML.Field1;
    vo.Field2 = voXML.Field2;
    vo.Field3 = voXML.Field3;
    Is there an easier/faster way to do this? Can't I do some
    sort of for/each loop. The element names are identical to the field
    names.
    Thanks.

    http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Live Docs_Book_Parts&file=usingas_053_9.html#220936

  • Create file object from xml file in different package

    I have my java class which is in a package...edu.xx.proj
    It contains the following
    File f = new File("formats.xml");
    My xml file is in the package edu.xx.proj.xml
    How do I get the file object for my xml file?
    Ultimately I want that once the jar is shipped .. The path of xml file shld be independent of my OS path... it can only lookup the package path..
    I will really appreciate it if someone can throw some input as to how to resolve this issue..
    Thank you

    I have my java class which is in a
    package...edu.xx.proj
    It contains the following
    File f = new File("formats.xml");
    My xml file is in the package edu.xx.proj.xml
    How do I get the file object for my xml file?
    Ultimately I want that once the jar is shipped .. The
    path of xml file shld be independent of my OS path...
    it can only lookup the package path..
    I will really appreciate it if someone can throw some
    input as to how to resolve this issue..
    Thank you
    InputStream inputStream = getClass().getResourceAsStream("xml/formats.xml");
    /* OR */
    URL url = getClass().getResource("xml/formats.xml");hth

  • How to create value objects from xml

    I am receiving xml back from my web service ( e4x ). I am
    trying to figure out how to create a value object without having to
    manually fetch each value in the value objects constructor. I am
    using introspecton in my Java web service to do this. Is there such
    a thing in Action Script?
    Anyone done this before that can share some code???? Any help
    would be very much appreciated.

    That's twice now I've heard that. lol.
    I am using Cairngorm and I suppose out of ignorance perhaps,
    I am using VO's. So my web service would return an Object Proxy and
    I have some code that could create objects dynamically from the
    results. The objects had to be simple of course and now they are
    becoming more complex thus the need to change to e4x instead of
    objects.
    So now I am trying to convert the xml result into the desired
    VO to be used throughout the rest of the application. I'm not sure
    how to use Cairngorm without the VO's they are tied to everything.
    Are you familiar with the architecture? Your thoughts?

  • Create java objects from xml

    I want to create a tree structure for java object. These java objects are populated after the parsing the xml. But what could be the logic for adding child to parent when there are
    many sub nodes? I wanted to use one recursive function which iterate through all the elements of the xml file. But I have not got the idea how to add one child object to parent object.
    following are my classes. Any help on this highly appreciated.
    public class TreeObject {
              private String name;
              private TreeParent parent;
              public TreeObject(String name) {
                   this.name = name;
              public String getName() {
                   return name;
              public void setParent(TreeParent parent) {
                   this.parent = parent;
              public TreeParent getParent() {
                   return parent;
              public String toString() {
                   return getName();
    import java.util.ArrayList;
    public class TreeParent extends TreeObject {
         private TreeObject treeObject ;
              private ArrayList children;
              public TreeParent(String name) {
                   super(name);
                   children = new ArrayList();
              public void addChild(TreeObject child) {
                   children.add(child);
                   child.setParent(this);
                   treeObject = child ;
              public void removeChild(TreeObject child) {
                   children.remove(child);
                   child.setParent(null);
              public TreeObject [] getChildren() {
                   return (TreeObject [])children.toArray(new TreeObject[children.size()]);
              public boolean hasChildren() {
                   return children.size()>0;
              public TreeObject getChild(){
                   return treeObject;
    private TreeParent getChilderen(Element rootNode){
         List list = rootNode.getChildren();
         String rootNodeName = rootNode.getName();
         TreeParent root = new TreeParent(rootNodeName);
         for (int i=0; i< list.size(); i++)
    Element node = (Element) list.get(i);
    if(node.getChildren().size() > 0){
         // TreeParent treeParent = new TreeParent(node.getText());
         TreeParent treesub = new TreeParent(node.getText());
         treesub.addChild(treesub);
         //TreeParent p = treeParent.getParent();
         // rootParent.addChild(treeParent);
    }else{
         TreeObject object = new TreeObject(node.getText());
         root.addChild(object);
    getChilderen(node);
         return root ;
    public TreeParent buildTree(String filePath) {
    SAXBuilder builder = new SAXBuilder();
    File xmlFile = new File(filePath);
    try{
    Document document = (Document) builder.build(xmlFile);
    Element rootNode = document.getRootElement();
    // List list = rootNode.getChildren("staff");
    TreeParent rootParent = getChilderen(rootNode);
    return rootParent ;
    }catch(IOException io){
    System.out.println(io.getMessage());
    }catch(JDOMException jdomex){
    System.out.println(jdomex.getMessage());
    return null;
    Edited by: 870611 on Jul 6, 2011 6:27 AM

    Hi
    I recommend you use the API JAXB. Is much simpler.
    here a link: http://www.oracle.com/technetwork/articles/javase/index-140168.html
    here a example: http://download.oracle.com/javaee/5/tutorial/doc/bnbay.html#bnbbc

  • How to refer the parent class object from an inner class

    Hi,
    I have a class X, which contains an inner private class Y. Class X has a method getY which returns an object of class Y. Class Y has a method getParent. I want to return the object of parent class from this. The code is like this:
    public inerface IY;
    public class X {
    private class Y implements IY {
    public getParent {
    // ... return the object of parent class which created the object of this inner class
    public IY getY() {
    return new Y();
    Can somebody help me with this...

    interface IY {
    public class X {
        private class Y
            implements IY {
            private X parent;
            public Y(X x)
                parent = x;
            public X getParent()
                // ... return the object of parent class which created the object of this inner class
                return parent;
        public IY getY()
            return new Y(this);
    }Filip

  • Recursivity in Oracle Java Class Generator from XML

    I am about to start using Oracle XDK for marshalling/unmarshaling XML documents but
    I need to know if the generator will be able to create correctly the java classes
    from a DTD that is recursive :
    <!-- #[START] -->
    <!ELEMENT node ( date, symbol, node* ) >
    <!ATTLIST node
    name ID #REQUIRED
    ref IDREF #IMPLIED >
    <!ELEMENT date (#PCDATA) >
    <!ELEMENT symbol (#PCDATA) >
    <!-- #[END] -->
    and also, if given a recursive XML (e.g. one compliant with the DTD presented above)
    it will be able to parse correctly the XML into the java classes.
    cheers
    francesc

    well, after having had to try out myself this specific functionality of the
    product, I'm happy to say that YES it works and unlike JAXB
    (maybe I didn't try hard enough with SUN JAXB) it allows recursivity of complex types.
    However, I'm not so happy with the lack of replies in this unattended (or so it seems!) forum
    cheers

  • Partially populating an object from XML data

    I have an unpopulated object which I intend to fill on-demand by grabbing several XML files via HTTP.
    I'm not sure how best to deal with this in Java - at present I keep a set of booleans to describe what information is present, and update these as I grab new data by parsing the XML
    Is there a way I can better use the object oriented features of Java to manage this?
    cheers,
    Jon

    Hi there again,
    Do you have zmaterial on your InfoSource? And in your InfoCube?
    If so, you only need zcolour in the Infocube and the way you're doing is correct. In the rule of the zcolour you can select master data attribute of and from the list it should appear all the InfoObjects that exist on the InfoSource that has zcolour as an attribute, in this case, zmaterial.
    If before you select the list of the InfoObjects available on the master data attribute of you click on F1 you see the help that says exactly that (and I have done it tones of times):
    Master data attrib.
    The specified characteristic has the characteristic to be updated as an attribute.
    With this setting, the value of the characteristic to be updated is read in the master data table of the specified characteristic.
    Example
    The Characteristic 'Material Group' is not delivered through the InfoSource.
    The characteristic 'Material' is delivered through the InfoSource.
    The characteristic 'Material' has the characteristic 'Material Group' as an attribute.
    You can fill 'Material Group' through the master data table 'Material'. To do this select the method 'Master Data Attribute from' and 'Material' as source.
    Regards,
    Diogo.

  • Loading LOTS of objects from xml

    hi
    I'm developing code that parses an XML file with known elements and reads the contents into objects
    I've been doing this using DOM
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    InputSource in = new InputSource(xmlFile);
    Document doc = db.parse(in);The trouble is that when I test reading in of over 6000 objects, I'm getting
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.getNodeObject(DeferredDocumentImpl.java:1000)
    at com.sun.org.apache.xerces.internal.dom.DeferredDocumentImpl.synchronizeChildren(DeferredDocumentImpl.java:1741)
    at com.sun.org.apache.xerces.internal.dom.DeferredElementImpl.synchronizeChildren(DeferredElementImpl.java:132)
    at com.sun.org.apache.xerces.internal.dom.ParentNode.hasChildNodes(ParentNode.java:194)
    at com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl.nextMatchingElementAfter(DeepNodeListImpl.java:168)
    at com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl.item(DeepNodeListImpl.java:143)
    at com.sun.org.apache.xerces.internal.dom.DeepNodeListImpl.getLength(DeepNodeListImpl.java:114)
    at business.PersonRegister.persist(PersonRegister.java:247)
    at business.PersonRegister.main(PersonRegister.java:807)
    I believe this is because there is insufficent memory to read the whole Dom document in before parsing...?
    Creating the objects and using them in memory is not a problem - it's much quicker than a SQL database, but I need a way of reading the XML file without first creating the entire DOM document.
    There must be a way of reading and parsing one element, creating the object, reading and parsing, creating and so on to save loading up the whole DOM document
    has anyone got any bright ideas please?

    thanks for both the replies above - essentially the same correct solution.
    something worth noting now that I've written and tested both a SAX solution and a DOM solution is that there is a significant (4 x) time penalty using SAX.
    I considering dividing the vector I am storing/recovering into chunks and saving each chunk separately using DOM to speed things up...
    any thoughts on this approach?

  • How to make a class object  from a string representation of the same

    i have the name of a class whose object i want to make in the form of a string i.e. String s="S1"; i get this name after some prosessing. so what i want to do is to create an object of S1 which is actually one class that i have implemented.plz hlp. it is urgent.thnx in advance.

    reflection api...
    see java.lang.Class. Read the api docs.
    mostly, u need to do the following:
    Class myClass = Class.forName(s1);
    Object x = myClass.newInstance();
    reg
    s giri

Maybe you are looking for

  • System preferences is frozen

    Hi, I have a mac pro desktop running Yosemite. Today suddenly I have no Internet connection and when I try to launch system preferences tge menu appears along the top, but nothing else except the spinning ball. Pls help! Thanks, Brenda

  • Is AskMate LLC a legitimate Mac security fixing company?

    As I was using my Safari to browse, I got a window which said something to the effect that my security had been breeched. For help, call (877)899-1824. They sent me a 6-digit code and were able to get into my whole computer. Name: Ask Mate LLC. They

  • How to copy image url in Safari? (iOS5)

    Hello! since I updated to iOS 5, I can't seem to find a way to copy an image's url when using Safari. Was this function removed? Thanks in advance.

  • How to activate and passivate member variables?

    Hi ViewObjects have methods like public void passivateState(ViewRowImpl currentRow, Document doc, Element parent)andpublic void activateState(ViewRowImpl currentRow, Element elem)However, I can't find any example how to use them. Can anyone show me a

  • Help please! brush and pencil tool vanished!

    hi, my brush and pencil tool when on the workspace are now represented by a plus sign and dont do anything.  i opened lots of different AI files and it was the same on all of them.  before the plus sign icon it was the smooth tool icon, and it did no