I heard xml is used as database, can anybody give me a simple tip or link to tutorial how to store some information in database ? what is the best use of xml on php realted to data things?
An XML database is a data persistence software system that allows data to be specified, and sometimes stored, in XML format. This data can be queried, transformed, exported and returned to a calling system. XML databases are a flavor of document-oriented databases which are in turn a category of NoSQL database.
If you run the XML file as a PHP script, then yes. The output of the script will be valid XML, but the file that contains the inline PHP will most likely not be valid XML. Save this answer.
XML is a format to store data along with its structure. This feature makes it useful for many things, including transferring data, formatting documents, creating layouts, and more.
I'm gonna throw my hat in, simply because I am working on a personal project that does in fact use XML as it's storage mechanism. Notice, I didn't call it a database. It's not a database, at least in the way most would define it. As expressed in an article I read recently, XML is not data oriented, it's document oriented.
In my case, I'm building a simple OO php/XML resume site for my girlfriend. I am using an XML file to store the content. I chose this mainly because it's small, lightweight, interchangeable, and easy to read. Initially, I thought I could just provide the XML to her, and she could fill in the blanks. XML is straightforward enough to allow a laymen to do that.
As I continued, I realized that it wasn't very difficult to throw in an admin type interface where she could simply enter values in a form and update the resume that way.
Since the site is not really a web site, but a web document, XML works well here and nicely separates content.
Of course, I could have used JSON as well, and I may in fact adapt things to handle either JSON or XML, but I decided to use XML initially simply out of familiarity, and (this is arguable) that I assumed it would be easier for a laymen to parse when entering content.
XML is not supposed to be used as a database but as a way to transport data in an application agnostic way. For example, say you have many RSS feeds in Google Reader and you want to add them into Thunderbird. You will export them from Google Reader in the XML format, and then import that XML file into Thunderbird. Both applications will know how to read and write from the XML and how to use the information (the RSS feeds) in it.
If you want to store information in a useful way that, for example, lets you organize and search through it, you will need a full fledged database. Some good ones are Mysql and Postgresql. Both of those work well with PHP and have extensive tutorials to begin with, all easily accessible via any search engine.
You can answer this question yourself after reading this very entertaining article by one of Stackoverflow founders:
Back to Basics by Joel Spolsky
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With