Question

Are there any tools available for transforming types defined in an xsd schema (may or may not include other xsd files) into ActionScript value objects? I've been googling this for a while but can't seem to find any tools and I'm pondering wether writing such a tool would save us more time right now than to simply code our value objects by hand.

Another possibility I've been considering is using a tool such as XMLBeans to transform the types defined by the schema to Java classes and then converting those classes in ActionScript. However, I've come to realize that there are about a gazillion java -> as3 converters out there and the general consesus seems to be that they sort of work, ie, I have no idea which tool is a good fit.

Any thoughts?

Was it helpful?

Solution

For Java -> AS generation, check out GAS3 from the Granite Data Services project:

http://www.graniteds.org/confluence/display/DOC/2.+Gas3+Code+Generator

This is the kind of thing you can write yourself too, especially if you leverage a tool like Ant and write a custom Task to handle it. In fact, I worked on this last year and open-sourced it:

https://github.com/cliffmeyers/Java2As

OTHER TIPS

I don't have any kind of translator either. What I do is have an XML object wrapped by an ActionScript object. Then you have a getter/setter for each value that converts xml->whatever and whatever->XML. You still have to write the getter/setter though, but you can have a macro/snippit handle that work for you.

So for XML like:

<person>
    <name>Bob</name>
    ...
</person>

Then we have an XML Object Wrapper class and extend it. Normally

class XMLObjectWrapper
{
    var _XMLObject:XML;

    function set XMLObject(xml:XML):void
    {
        _XMLObject = xml;
    }

    function get XMLObject():XML
    {
        return _XMLObject;
    }
}

class person extends XMLObjectWrapper
{
    function set name(value:String):void
    {
        _XMLObject.name = value;
    }

    function get name():String
    {
        return _XMLObject.name;
    }

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top