0 Replies Latest reply on Aug 9, 2007 8:35 PM by awootton

    Unmarshalling XML in flex/actionscript.

    awootton
      We debated this all day. Just wanted to know what people thought.

      We were disgruntled with the JAXB solution of converting XML to java objects (on our server), so we looked around.
      We like XStream, it's simple and honors annotations in our java5 code.

      Then, we discovered that we could just as well use JSON. Then, it turns out that corelib has a routine to create ActionScript Objects from JSON messages.

      For the life of me, I can't find the equivalent routine to convert xml to objects. Xml always becomes an XML object, not an Object.

      I love the syntax where one can inline an xml declaration:
      eg. var message:XML = <root><username>{username.text.toLowerCase()}</username></root>

      But, I don't want to do that, ever. I'd rather make a message Object and serialize it into xml or json.

      The best solution would be if we could create our defined objects (not just generic Objects) from the incoming message. I could probably modify com.adobe.serialization.json.JSONDecoder to do that.

      We ran a sample (blog reader, lost the url) app this morn that reads XML via mx:HTTPService, it was easy to convert it to use JSON instead of xml. It's a lot of six of one and half dozen of the other.

      Anyway, here's my question. Are we going to go to hell if we use JSON and not XML for data exchange with our server? Is there some deep dependancy on XML that will bite us in 3 months?

      Inquiring minds need to know :-) - a

      (yes, I know Data Services would obliviate this concern, but we don't trust you guys to be infinitely scalable, so we write our own).