Hi everybody, I'm working partime for an company and my boss ask me to make an module for prestashop to read/write news ( only Text ) into a XML file. But i think load text form XML will be slowly. Anybody can tell me save text in XML file or Database, which better and why?? Thanks. :)
If the requeriments of news just involve text, i would prefer the Database Approach for storing, and XML as a way of transmitting data. The RDBMS are smart enough to handle text data.
I assume that we're talking about a small number of text entries since this is a news feed for an eCommerce site.
Given that assumption, you will probably not see a performance hit either way.
One advantage of XML is that you could format the XML as an RSS feed and then use the RSS feed for other things as well.
If you save the items to a file, there will be a lot of XML parsing and file I/O you'll need to handle yourself. If you save the individual news items in a database, the database will handle the I/O for you (probably much better than you could do yourself). If you need the news items in XML format for some reason, store them as XML in the database; most modern enterprise-class RDBMSs offer a native XML data type and some pretty good functionality for transforming the XML as needed.