February 17th, 2013, 04:38 AM
XML vs Database
I was playing a bit around with the php domdocument stuff which made me wondering the following. I noticed that quite some CMS use xml-files to accompany templates, components and plugins (pretty much third party software to extend the cms).
My question is, is this just done because it's easily (human) readable, (maybe even easier to manage)? Or is there another advantage opposed to storing for instance settings in a database. I can imagine that opening a flat file every time is more time consuming than querying a database that is designed for storing data (so maybe also settings).
Love to hear what you guys think of it.
February 17th, 2013, 05:57 AM
XML files are usually used for static configurations that are not supposed to be edited by non-developers. Putting that into the database wouldn't make much sense, because the data is neither dynamic nor meant to be edited through a GUI.
However, I wouldn't necessarily use the cumbersome XML. JSON or YAML is much more readable.
Comments on this post
February 17th, 2013, 06:28 AM
Thanks for the reply. That makes sense; using the Database for dynamic data and xml, json for static data. Should have thought a little longer about it. I am sure though we want to store very crucial static data as variables in a .php-file so it wont be spit out to the browser.
February 21st, 2013, 07:53 PM
I'm using xml in a mobile game because when I was using php+mysql on my tablet, when the internet was finicky, it made it unplayable. It's just a single player game so if someone takes the time to edit it on their phone so be it. I was considering adding a manual save button that would upload the attributes in the file to mysql.
March 14th, 2013, 04:25 AM
March 14th, 2013, 02:26 PM
Who cares about Higgs boson, we've found the fifth Trident dentist!
Originally Posted by peter_solutions
“Today you are You, that is truer than true. There is no one alive who is Youer than You.” - Dr. Seuss