开发者

using xml as database in php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 8 years ago.

Improve this question

I heard xml is used as database, can anybody give me a simple tip or lin开发者_开发问答k to tutorial how to store some information in database ? what is the best use of xml on php realted to data things?


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


Check out some of the responses I got to my question "Is there a simple, flat, XML-based query-able data storage solution?" on the Programmers.StackExchange Site.

It's a mixed bag. SimpleXML is great with PHP, but there is a lot of FUD when it comes to XML query languages and implementations..


To add to what Fanis said, if you want something lightweight then I strongly recommend MongoDB or SQLite

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜