View Full Version : How "good" is XML?
04-12-2005, 12:20 AM
Forgive my rather strange question, but it seems like a lot of ppl are using XML to do almost everything. I'm building a site with AS 2.0 and get some of my data from XML files... Can anyone tell me if this is "good" and safe, is it possible for a visitor to block XML, with a browser, firewall etc? Or more precisely - is it possible to block a SWF file from accessing the XML data on my server?
04-12-2005, 01:59 AM
From my understanding(although I am not an expert) is XML is more about storing data, you need an application such flash to interface with and do something with the data. Firewalls will normally stop scripts that are dangerous and can store or call a virus more likely to be java or exe or something. So I would think it highly unlikely that firewall would block a swf file calling xml data.
If your still unsure why don't you upload to your server, then mess around with your firewall settings to see if you can block it
04-12-2005, 03:59 AM
no, firewalls will never block an XML script. XML files actually do not "send" or "execute" anything, they just keep data organized, and that's it. Anyone can read an xml file, all they have to do is go to the URL of the XML file, and the browser will automatically display it, for example, take a look at the following. Don't freak out when you see it, this is not an XML file, it is just displayed the same way. This is a "Web Service", or WSDL file. It's just used to send and receive data (it's actually how google works, you can download the source files from google API's section)
Anyways, it's just what an XML file looks like...
If you notice, everything is easily visible, and as far as I know there is no way to "mask" data in an XML file, so the storage of sensitive data is not a wise idea ;)
04-12-2005, 08:50 AM
Thanks guys, this is good news to me. No the data is not sensitive in any sense, so it won't be a problem from that point of view. And it is more convenient to load the data from an XML file rather than a TXT file. :D
04-12-2005, 09:58 AM
XML is great, which is why everyone does use it, from Microsoft and Macromedia, to Linux users.
It's easily extensible, and scaleable, and as a system of storing data, it's very easy to understand becuase it is so flexible in creating complex data structures.
It can easily translate into data structures from databases, RSS newsfeeds for the web, pretty much anything you want related to data. So it is useful for both server transactions and as a local storage medium.
04-12-2005, 10:15 AM
XML is not as great as people make it out to be. People use it needlessly. Please read this thread, you will find it useful. Half the time it is used, it is used incorrectly, or just to display those 3 magical letters X.M.L. When you stop and think about it...
local storage medium.
..a sentence that doesn't really mean anything, and a txt file can do exactly the same. Have a read of the thread i gave a link to.
04-12-2005, 10:50 AM
I completely agree that it can be used potentially needlessly, or 'incorrectly' as you say, in cases where extensibility is not an issue, and some people do use it for the sake of practising its use. But given that everyone's trumpeting its use as the future standard of data transfer and storage, for useful data, I, at least reckon it is not that bad to learn how to use it, rather than just a text file, when the requirements of the project appear to be unknown.
04-12-2005, 12:11 PM
its an achingly verbose medium, whih takes ages to parse. it is only worthwhile using if you have complex data structures indicating relational data or oo data. as a data carier it is useless without its querying langauge, namely XPath. i would advise anybody to rather use remoting over xml to load any data in.
but on the otherside, xml is an industry standard in server->server communications since it runs over port 80 and uses tcp/ip http. we only use xml when we have to, and because we are querying data via webservices, we have to (adding a remoting layer is not an option)
04-12-2005, 12:28 PM
its an achingly verbose medium, whih takes ages to parse. it is only worthwhile using if you have complex data structures indicating relational data or oo data
I couldn't agree more.
as a data carier it is useless without its querying langauge, namely XPath.
Could you explain a little more hangalot. I use XML quite regularly (whether it be for menu's in Flash or as web.xml on Tomcat). However, i never use XPath. Also when you say data carier, what do you mean?
Regards, snapple :)
04-12-2005, 12:28 PM
Well, it is nice to see that people have different opinons about XML! I intended to use XML to load comments to photos in a simple FLASH/AS based photo gallery. And since I want the gallery to be easy to maintain and expand I prefer to load the comments from an external file, so I started and implemented a function that read the comments from a TXT file (it's about 500+ photos). But the TXT file ended up not being readable, due to all & and &'s (I mean - AS could read it, but I couldn't), so I googled a bit and found:
which was rather interesting... I managed to convert the TXT file to XML and re-write the read-function within 5 minutes, and it seems to work faster than reading from the TXT file.
However, I also thought about implementing a PHP script that gets the data from my MySQL data base, any opinions whether or not this is better than loading the data from an XML file?
04-12-2005, 12:36 PM
as said xpath is the quesry language associated with xml. there is a very basic implementation inside AS2, not worthwhile looking at. what you want to use is the AS2 or AS1 implementaion availible for free @ www.xfactorstudio.com
now lets say i have the following xml
to use xpath instead of creating a new XML document i would create a new XPathDocument (am going to do it in AS2 now)
var x = new XPathDocument(theAboveXmlString); // xpathdocument inherits from xml so everything you now like load, onLoad is availible, but it includes 2 extra functions.
var reArr:Array = x.selectNodes("//node"); // return all nodes in the xml document with a nodeName of array no matter what depth they are
var reArr:Array = x.selectNodes("//node[@id='2']")//return all the nodes where the attribute named id is equal to 2
var reArr:Array = x.selectNodes("//node[@id='2']/text()")//return all the text nodes associated with nodes where the attribute named id is equal to 2
you get the idea? go to the site i pointed out, there are some tut's linked from there.
04-12-2005, 12:37 PM
with data carier i mean a way to package your data in a retrievable structure. i don't consider nesting 5 for-loops as retrievable
04-12-2005, 12:45 PM
How much size is added when importing:
I don't have Flash here at the moment so I can't check myself!?
04-12-2005, 12:54 PM
Thanks tons for that hangalot, that's good stuff to know, and i didn't know it. So it is much appreciated, i might give it a go soon.
Thanks for the link too.
Regards, snapple :)
04-12-2005, 01:36 PM
12 kb is the size of the xpath lib's
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.