I think Steven has already sent you the XML2AS code which is great. You
could also try the XMLParser class I wrote which is similar but adds a few
features. You can basically throw your XML document at it and it'll spit
back an object with properties & arrays that follow the naming convention
from your original XML document which makes it a lot easier to get at the
data (in my opinion at least). It'll retain your hierarchy too.

Snag it at:
http://www.greensock.com/ActionScript/XMLParser

Hope it helps. 

Jack

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Sascha
> Sent: Monday, December 11, 2006 7:54 PM
> To: 'Flashcoders mailing list'
> Subject: [Flashcoders] Which Data Structure is good for this?
> 
> I would be interested in recommendations about what kind of data 
> structure is best used in the following situation.
> I'm loading in a XML file with a typical recursive structure, then the 
> data from it should be parsed into a data storage object and this data 
> should be accessible globally through the application. The XML file 
> has a structure like this:
> 
> <resourceList>
>       <display type="1">
>               <displayProperties>
>                       <property name="foo" value="doo"/>
>                       <property name="fee" value="faa"/>
>               </displayProperties>
>               <displayObjects>
>                       <object id="1" file="foo/etc/file.xml"/>
>                       <object id="2" file="foo/etc/file2.xml"/>
>                       <object id="3" file="foo/etc/file3.xml"/>
>               </displayObjects>
>               <backgrounds>
>                       < backgrounds id="125" file="foo/etc/bg.png"/>
>               </ backgrounds>
>       </display>
>       <data>
>               <dataTypes>
>                       <property name="foo" value="doo"/>
>                       <property name="fee" value="faa"/>
>               </dataTypes>
>       </data>
>       <etc>
>               <somethingElse>
>                       <property name="foo" value="doo"/>
>               </ somethingElse >
>       </etc>
> 
> ... The XML is being extended by the time but it retains the shown 
> hierarchical structure. I want to be able to keep a similar structure 
> in memory but I don't want to keep it as an XML object. I was thinking 
> about using a custom object and populate it with HashMaps but then the 
> hierarchy would be too flat.
> I would appreciate it if somebody could give me some suggestions what 
> kind of data structure is a good choice for this as I don't have much 
> experience with trees, lists and other more complex structures.
> 
> Thanks a lot,
> Sascha



_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to