Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XML and its uses in Databases

Tags:

xml

What is XML and how is it used in databases? If this looks like a homework assignment, it is.

like image 375
user431372 Avatar asked Oct 14 '22 00:10

user431372


2 Answers

Databases are often used to store blocks of XML for applications which do not want to serialise it out to an actual database schema. But generally speaking, XML is not used in databases.

This is imply because databases are about storing data where as XML is really about transmitting it in an agnostic manner.

(Simplified) Usually what happens is application A converts data from database A into an XML stream which is transmitted to application B. Application B then converts the XML into a series of SQL statements which create records in database B.

There are lots of other scenarios, but this gives you a general idea.

like image 147
drekka Avatar answered Oct 20 '22 17:10

drekka


Xml (Extensible Markup Language) is a mark-up language for encoding documents in a machine-readable format, with emphasis on flexibility, simplicity and usability over the internet.

Its main advantages over other encodings are interoperability - many programming environments have the ability to read and parse xml, and it has the advantage of being human readable. For this reason xml is commonly used when transporting or communicating data (such as on the internet).

The Wikipedia page on xml has a lot more specific information, however some examples of various uses of xml are:

  • RSS, a protocol used to publish feeds of frequently updated content.
  • XHTML, an extension of HTML
  • SOAP (Simple Object Access Protocol), a protocol commonly used for structuring information in web services

Conversely, xml's verbosity and flexible structure comes at the cost of being relatively expensive to read (in terms of computational power) and so xml is not generally used as a storage encoding in performance oriented applications (such as databases).

In terms of how xml would be used in databases - a database might choose to expose data to its client in an xml format or accept data from the client in an xml format. Databases might also be used to store "Blobs" of xml data as records in a table, however this comes at the cost of it being difficult to query the database based on the content of that xml.

like image 32
Justin Avatar answered Oct 20 '22 16:10

Justin