Click to See Complete Forum and Search --> : XML vs database


npqster
03-21-2008, 08:28 PM
Is XML the markup version of a database and if so, will it be replacing MySQL etc...?

NogDog
03-21-2008, 08:47 PM
No. XML is just a text mark-up language (as is HTML or SGML). It allows you to organize textual data within that file in something similar to the way a database does, and therefore can be used as a standardized method of transferring data between discrete applications without those applications needing to know anything about how the other application natively stores and manipulates that data.

But XML by itself has no data manipulation mechanisms by itself analogous to any DBMS and its SQL interface, so any such manipulation requires that each application that would want to deal with that XML data needs code that can parse, interpret, and otherwise organize the data it receives from an XML file.

A true DBMS, on the other hand, is optimized specifically for storing, searching, organizing, and retrieving the data stored within it. If you store a few thousand records worth of data in a MySQL (or PostGre, or Oracle, etc.) database and store the same data in a XML file, you can be 99.999% sure that any sort of data manipulation you can do from within a program will be much faster using the DBMS than using the XML file. And on top of that, any decent DBMS comes with a host of utilities for database backup and restore, performance analysis and tuning, along with built-in functions for working with the data.

npqster
03-22-2008, 01:09 AM
that was really helpful

ssb
03-22-2008, 02:52 PM
Is XML the markup version of a database and if so, will it be replacing MySQL etc...?XML is only method of data representation. I think languages like XQuery/XPath have perspective and may replace SQL sometime for tabular not only XML processing. If to see history of SQL, first version of SQL was developed at IBM in the early 1970s. Then SQL was adapted as a standard by ANSI in 1986 and ISO in 1987. XQuery 1.0 (and XPath 2.0) became a Recommendation by W3C only in early 2007, 30 years later than SQL. So you need wait 30 years the same popularity for XQuery that SQL has now. :) (I think less really.)

Look at this example about XPath from http://savtechno.com/articles/ClassRelationalApproach.html
AS
A B
a b1
a b2

BS
B C
b1 c1
b2 c2This is SQL request:
select BS.C from AS,BS where AS.A='a' and AS.B=BS.B
This is the same request in XPath:
A[.='a']/B/C