PDA

Click to See Complete Forum and Search --> : XML over plain text files?



pmineault
05-16-2001, 02:20 AM
Hey all,

OK, I know ActionScript pretty much inside out, except for XML. I know, however, what an XML file is.

Now, can someone tell me what XML in Flash would be useful for? Of the little I know about it, it's a way to get information into Flash in a hierarchical manner. Now, can't that be achieved with loadVariables() and an ordinary text file? If so, why would I use XML in the first place, as it seems more complicated, what with the complex array parsing and whatnot I've seen?

I'm guessing the advantage here is in the 'XML Socket' I keep hearing about. Now, please tell me, what the heck is an XML socket? Is it a way to keep permanent connections or something? Like for a chatroom?

Please help me, I'm fairly confused.

Hythian
05-17-2001, 04:36 PM
For XML to be useful you really have to see its scope as more then just replacing textfiles for getting information into Flash.

Say you are building a commercial site. The client wants it in plain html, fancy DHTML, Flash5 and WML.

Without XML, you are looking at building four complete entire sites. Having to duplicate the content across every page, over and over again.

With XML, you can put all the content into an XML file per page. If the user wants to see it in Flash, the movie will load the XML file in, and use it for the content to be displayed. If the user wants HTML, a simple style sheet can format the XML page to be viewable. DHTML is the same way but with nifty scripting includes as well. For WML you will probably need an XSL transformation sheet to convert it to be good WML markup but you are still using the same file for content there.

Think about site maintenance without XML, you would have to change every single page by hand and re-export the Flash movie. With XML you change the content inside that single XML file and it will be updated on every view of that page.

It's not that XML allows you to hierarchically ( is that a word? ) load variables into Flash that makes it important. Its that it allows you to write the content once, and then use that same file over and over that makes it important.

pmineault
05-17-2001, 05:05 PM
Okay, I see your point, but can't you do the same kind of thing with text files? I use php and mySQL frequently to output my HTML files. I can use these same pages to output ordinary text files that can be generated on the fly, using the same content as the HTML (through the mySQL tables). Now, isn't that the same thing as what an XML file can do?

Hythian
05-17-2001, 05:18 PM
You are taking the level of content management up another level, so that the XML file is replaced by the database. You are still outputting two seperate files instead of the singular XML file, but your content management is at the database level. It's really a matter of taste at that point.

As for XMLSocket, yes it is something of a way to have a persistent connection inside of Flash. You need something on the server to handle the connection ( Branden Hall wrote a Java app. called AquaServer to do that, don't have the link on hand to download it but it is mentioned often here and in the Flash5 Actionscript forum ), but you can have a Flash chat room where the content is passed back and forth as XML files.