XML and relational databases are both technologies for structuring, cataloguing and processing data. If data has a regular and atomic structure, it is more appropriate and efficient to use a database than XML. In this case, why would you wish to go to the trouble of converting such data from a database into XML and vice versa? Reasons include:
- XML is easy to convert further into different formats as required: e.g HTML, PDF, and plain text. This gives a flexibility to web applications where data can be searched for and accessed from the database, and then formatted for output in different formats using e.g XSL.
- XML is already a standard for data interchange, so you may need to pass your data on to others as XML or take XML as input. There are advantages over competing technologies such as EDI. A feature of XML allows XML from different sources to be processed together to give a combined result.
- In Web applications, XML can theoretically be used to reduce server hits and load on the server for sorts etc, because some processing can be done by the client browser. However, in practice many browsers in use have no or limited XML capability.
- XML is a non-proprietary standard and is unlikely to become obsolete.
On the other hand text documents, which are usually irregularly structured, cannot be effectively stored in a relational database. In this case, you can only store them in the database as BLOBs, which cannot be searched or processed in the normal way. However, there are cases where this is still desirable: very large repositories of pre-existing XML/SGML documents. The database can be used for cataloguing and searching, and documents once extracted can be processed further using XSL/XSLT.
The article continues at