View Full Version : PHP vs XML
Silvertiger
07-02-2006, 12:09 AM
I have been working with PHP/MySQL for some time now and feel fairly comfortable using them to create data sets to generate html pages, or to pass to flash in variable/value pairs or as dynamic imported html formatted text.
I was recently trying to create a page with a news column and a collueague of mine said "why don't you just use XML?". The thought never occurred to me because I have no experience with it. Then I thought about how a game I play (World of Warcraft) uses XML/LUA files to represent data in a similar way. Is there any reason I should shift to XML which from my understanding would require me to somehow generate the xml file on the fly from my MySQL database, or am I ok sticking with the PHP methods I have been using?
XML is very comune
do you need it ? it depends what you wana by prepared for !
i not like xml and as i program for fun i not use it :p
if you need to save data whitout a DB it's the easyest way as most languages will have parser for it
it's human readable wich is also a big plus
if you program for money (as a busnes)
it's always good to know as much you can ;)
acolyte
07-02-2006, 10:30 PM
Hi Silvertiger ,
you could start with this Dom examples to get things started with sql/php and
xml >>
http://www-128.ibm.com/developerworks/opensource/library/os-xmldomphp/
i hope this helps
greets
Silvertiger
07-06-2006, 11:08 PM
Hi Silvertiger ,
you could start with this Dom examples to get things started with sql/php and
xml >>
http://www-128.ibm.com/developerworks/opensource/library/os-xmldomphp/
i hope this helps
greets
Thank you for your responses. I see now that XML isnt the beast i thought I was looking for. I primarily use databases to access data, not static sources. While I could modify or re-write an XML file.. I'd prefer to use databases.
thanks.
silver tiger
sleekdigital
07-07-2006, 03:05 AM
When that person asked you, "why not use XML", they probably were not talking about how to store the data but rather, how to present the data to flash. Its not a question of PHP vs XML, its more like XML vs a string of variables. You could use PHP to generate either one or you can manually write either one. It doesn't matter if the source of the data is a database or anything else. And it doesn't matter if you use PHP or ASP or any other server scripting. The point is, you have 2 basic ways to present data to a flash application... as a string of variables or as XML (there are others, but for the sake of this post, these are the 2 we are focusing on).
The reason you might choose XML over a plain old string of variables is because xml has structure... you have elements that can be nested inside one another and each element can have attributes... that sort of thing. This can be very helpful when dealing with complex data. If your data doesn't need to have any sort of structure and there are no relationships within the data, then just stick with the string of variables. If you find yourself naming variables with numbers that relate to other variable names... that's a good sign that you may benefit from using XML.
One other reason you might use XML is if you want your data to be available for other purposes, since XML is so commonly used by various data consuming clients
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.