Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Actually, it is possible, this guy wrote up how to use the XMLDecoder and XMLEncoder classes in the flex framework to parse/write xml based on a schema:</p> <p><a href="http://blog.misprintt.net/?p=181" rel="nofollow noreferrer">http://blog.misprintt.net/?p=181</a></p> <p><a href="http://blog.misprintt.net/?p=192" rel="nofollow noreferrer">http://blog.misprintt.net/?p=192</a></p> <p>Example application showcasing both parsing and writing: <a href="http://misprintt.net/examples/xmlSchema/" rel="nofollow noreferrer">http://misprintt.net/examples/xmlSchema/</a></p> <p>However, it should be noted that there are several bugs in these classes which may or may not cause problems for your specific application. One of them, if I recall correctly, is directly related to optional parameters with default values in the schema. In some (or perhaps all) instances, the default value was never set. However, these bugs are usually very easy to fix once you've figured out where in the Encoder/Decoder classes the problems lie (because it's almost always those two classes). It can be tricky to spot the error due to these classes highly recursive nature, but for smaller schemas (and subsequently xml files) it's not really difficult.</p> <p>You still have to create the ActionScript types for the corresponding schema type though. This could be done somewhat automatically by having the XMLDecoder spit out it's result in an anonymous object and then serializing that object into a JSON format or AS class format directly. However, unless all attributes and elements exist in your xml, you're going to miss out on some properties. There is also this project, which I have yet to evaluate: <a href="http://www.graniteds.org/confluence/display/DOC/2.+Gas3+Code+Generator" rel="nofollow noreferrer">http://www.graniteds.org/confluence/display/DOC/2.+Gas3+Code+Generator</a></p> <p>It supposedly converts Java beans to AS3, and schema to Java beans converters are a dime a dozen these days.</p> <p>Hope it helps!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload