Question:
XML / Database confusion?
theangman
2008-09-11 10:51:37 UTC
Hi,

I'm new to XML and I am still trying to figure out the usefulness of it. I have been creating dynamic web pages (in php) without the need for XML. Considering this XML file:





Empire Burlesque
Bob Dylan
USA
Columbia
10.90
1985



Why would I want to store a catalog of CD in XML? I could simply just put all the data above in a database. I don't really get it.

I hope someone can give me some illustrations or a better explanation? Thank you! :)
Four answers:
Ram
2008-09-11 11:15:39 UTC
You may put every thing in a database. Then you can make it available to other people, may be on a web site in human readable format. But imagine, if you ever want to make your data (such as a CD catalog) portable, so that somebody else can make use of it, not just to read it or display it, but to let one of his own front end software consume it. Consider a third party software which compares the prices of different CDs, or a software which lists out all the CDs made during a particular year. You need to let those third party softwares have access to your database in order to function. But it would be difficult, if not impossible for them to download the whole database, such as an RDBMS. The easiest medium to port data across any network is text (as it is light and consistent across platforms). But a plain text file (such as a tab delimited or comma delimited) might have the data, but might not be meaningful enough.



Consider this data



Empire Burlesque Bob Dylan USA Columbia 10.90 1985



You may still manage to make some sense out of it, but consider this one





Empire Burlesque Bob Dylan USA Columbia 10.90 3.50 1985



It has all the data, but you may not really understand what that 3.50 is.



Now have a look at this







Empire Burlesque

Bob Dylan

USA

Columbia



10.90

3.50



1985







I bet, it is self explanatory.



In summary, XML is required to make your data 1. Structured 2. Portable 3. Reusable and 4. Consistent across platforms.



Hope that helps!
Blade Runner
2008-09-11 11:07:08 UTC
Why would I want to store a catalog of CD in XML? Because XML is plain text file and any program can read it by parsing the file without needing a driver to read a database file that could have a custom propertary design only understood by the software maker.

In this case, by saving the catalog in XML format, you can read it from the music machine, from the software that you could use to search for artists, from the software that you could use to mix music given the fact you also added a tag(field) with the path (URI) of the song or CD file to the XML file.

The XML format came up to the world with the main objective of helping in interchanging information among systems without work too much, in this as well as others cases just save a file in XML, code a parser, and read wherever you want.

There is more in The XML world, but that is another question.
burrage
2016-11-02 08:38:09 UTC
XML databases assist you save training marked-up employing XML without the ought to map that training to the tabular structures used by way of relational databases, which do no longer sort hierarchy nicely. it is, XML databases are dazzling database administration structures designed and optimized for the storage of training in an XML representation. there is not any ought to bite or shred XML structures into tables.
helper
2008-09-11 10:57:34 UTC
Yes you can simply store it in database but then you'll be the only one that can read it.

XML's best and wider use is as interface between dissimilar databases , applications, etc. It provides common data format that every platform and application can understand


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...