Page 1 of 1

Suggestions on implementing a xml Database

Posted: Sat Dec 05, 2009 4:02 am
by ashipj
Hi guys,
Am trying to make a xml file, to act as a small database. It will have a structure as given below.

Code: Select all

 
<?xml version="1.0" encoding="ISO-8859-1"?>
<db_name>
    <tbl_video>
        <video_id>"001"</video_id>
        <file_name>"sample.wmv"</file_name>
    </tbl_video>
    <tbl_video>
        <video_id>"002"</video_id>
        <file_name>"sample.mov"</file_name>
    </tbl_video>
</db_name>
 
I need to
1.) read from the from existing entries (select statement with where clause) and print out data.
2.) write to existing xml file (Insert statement)
3.) Update xml (Update statement)
3.) Save xml file

I shall handle logic behind SQL statements, but i need suggestion to start, as i am unfamiliar with PHP XML libraries. I have gone through most of the libraries (SImpleXML,DOM, XMLParser, XMLreader, XMLwriter) but none of them alone seems to have all features which i need.

Could anyone advise me on how to implement this.

Thanks and Regards
ashipj

Re: Suggestions on implementing a xml Database

Posted: Sat Dec 05, 2009 12:29 pm
by AlanG
As XML is extensible; adding, updating and removing various elements is a piece of cake. You want to use SQL to do this for you. Here's the problem. You will have to parse and translate queries yourself, which is essentially re-inventing the wheel. Lucky for you, the problem is already solved. :)

There are 2 main types of XML databases. Native and xml-enabled. Native databases are designed to handle XML documents and use their own query language (usually XQuery or XPath). XML-enabled databases generally just hide the entity-relationship model behind a nice XML front.

Here's a nice article to get you started: http://www.kitebird.com/articles/mysql-xml.html