Txt Vs XML

Hello,

I’m wondering what the benefits of loading text data versus xml data into Flash are? Is there a huge speed difference between the two? For example say I’m loading the same amount of data from a text file and an xml file - which would be faster?

Any other benefits or disadvantages between the 2?

Thanks

:mario:

I don’t know about the speed, though I have a feeling that txt files are faster. That’s just a feeling though, don’t take my word for it.

If I’d have the choice, I’d definitely go for XML, mainly because XML is a lot more structured than an ugly serie of &'s, variables and values.

Compare these two:

&var=value&var=value&var=value

<vars>
<var>Value</var>
<var>Value</var>
<var>Value</var>
</vars>

You’ll have to admit that XML is a lot more structured and manageable. XML’s primary goal is data storage by the way.

If you’ve got a small amount of data to load (like a single textstring), I suggest you use the txtfile, 'cause it’s a lot of work with getting the XML parsed in flash, and then it’s simply not worth it.
But if you’ve got a lot of data or data that you wan’t to be able to edit easy, the XML is preferable.

Case one:
You’re about to load the strings “Hello there little kirupian” and “Voetsjoeba is a belgian guy” into a flashmovie.
My choice: Text-file.

Case two:
You’re building a dynamic menusystem with 6 topMenus with 15 subMenus each. You load each menuItem from the external file.
My choice: XML-file.

I’m probably looking at something like case 2 with alot more variables. Any other good sources for learning how to parse XML with Flash? Once the XML is parsed in Flash can I do things like slice the string and turn it into an array?

Foo :tie:

*Originally posted by foochuck *
**Once the XML is parsed in Flash can I do things like slice the string and turn it into an array?
**

correct.

you can always search here on the forums, but this will get you started:

XML-driven drop-down menu:

XML with Flash basics:
http://www.kirupa.com/developer/actionscript/xmlbasics.htm
http://www.kirupa.com/developer/actionscript/xmlinflash.htm
http://www.kirupa.com/developer/actionscript/xmltofromflash.htm