views:

165

answers:

1

...as it loads and save me having to duplicate the whole data structure by hand and set each type manually. It seems such donkey work should be quite unnecessary in this modern day and age but I can't find a shred of info on the web to help me avoid it! Surely this whole new e4x thingy must support type casting somehow?!?

Cheers,

Roger.

+1  A: 

Fundamentally the answer is no, XML schema support does not exist in AS3.

There are various libraries for transforming certain XML schemas to and from more ActionScript-centric data structures (heck I made a WDDX parser/encoder back with Flash 5!)

E4X is all about traversing and filtering XML structures, not parsing it into something else. That being said, with the power of E4X it is often possible to create a class around an XML object that provides accessor methods that just use E4X calls to get and set the data you want.

Branden Hall
Fair enough, interested in what you say about using E4X to build a kind of wrapper class but this is quite a simple case so I'll just do it by hand. I just wanted to make sure I was getting off on the right foot with XML in Flash and not adding extra layers of classes if I didn't need to.