XML stands for eXtensible Markup Language and it is a W3C standard which is primarily used for storing, transporting and sharing data. It is widely used on networks today for these purposes. Because it stores data and the availability of several programming tools to enhance the efficiency of XML, it has drawn so much comparison with relational database management systems (DBMS).
It is a markup language like HTML. However, while HTML is used to display data, XML is used to describe the data. Unlike in HTML where there are pre-defined tags, in XML the user defines his/her tags. These tags are defined to describe data. So in XML, tags are defined by the user to store data. A typical XML document will consist of user-defined tags (or elements), tag attributes and data.
XML stores data which can be transferred from one application to another. Because XML is platform-independent, its use for transferring data means we can easily share these data between very different types of applications.
One other reason that the use of XML has been on the increase on the World Wide Web is because it stores data in plain text format, which makes it compatible with almost any type of software and/or hardware. Because it is independent of hardware and/or software, organisations can easily back up data in XML format, carry out upgrades or migrate to another application from a different vendor and restore data from the XML files after the migration.
Another key advantage of storing data in XML format is that it means the data has higher availability than data in other forms of data sources. This is because it can be easily read by different types of applications and fed into online resources such as web pages, databases, RSS feeds, etc quite easily.
XML as a Database
A question often asked concerning XML as being a means of data storage is that is it a database? In as much as this is a tricky question to answer, the writer’s view is that based on the context of what constitutes a database in the real world today, we might not refer to XML as a database. For instance elements such as indexes, data integrity, triggers, queries across multiple documents, etc will not be generally found in XML and they are some of the core elements found in databases.
The use of XML for data storage should be well thought of and restricted to certain instances. For a small, single-user access, it can be okay, such as using it to manage a contacts list. The widespread mode of usage for XML on the Internet also confirms this, as it can be observed that configuration files, software updates, etc use XML to store data.
Just like standard relational databases, XML makes use of query languages to store and retrieve data from XML documents. Some of the most common XML query languages are XPath, XQuery, XSLT, etc. Also custom query languages could be developed for storing and/or retrieving data from XML files.
The use of XML to share data is also very crucial. For instance, you could have an e-commerce website on the Internet which receives an XML feed from another application to update product values such as stock level, sale price, etc. Also the e-commerce website could process online transactions for customers and once successfully completed, send the order details to the application, such as SageLine (a Customer Relationship Management application) to process the order and ship products accordingly.
So order details such as Billing/Shipping addresses, Order Totals, Order Items, etc could be exported from a DBMS such as MySQL to an XML document which is imported into the CRM solution, using it to populate fields within its own database, which could be MSSQL. So in that case, XML will have been used as an intermediary for data transport, storage and sharing between a MySQL database driven website and a MSSQL database driven web application.
Accessing data from XML documents could be slow. This can be attributed to the verbose nature of the documents which results in large files and consequently making parsing and text conversion a slow process.
Also, the security of data in XML documents is an issue. Data security in XML can be categorically divided into two different modes; implementing security at row/column level or at node level. However, the data is still susceptible to being hacked while being transferred from one application to another on a network.
Just like most other data, it could be encrypted in order to secure the data. However, that also implies that the XML file becomes larger in size and issues with the speed of accessing information becomes more apparent.
Because data needs to be logical and structured, Document Schemas exist to check the integrity of XML documents. An XML document schema basically defines the structure and data constraints of an instance XML document. So to validate an XML document, it is passed through a validator alongside the schema. The validator checks the document against the structure and data constraints defined within the schema and gives a report as to either the document is valid or not.
Several XML schema languages exist, such as DTD (Document Type Definition), RELAX NG (Regular Language for XML Next Generation), XML Schema, etc. Also, there are several free and recommended XML Validation tools on the Internet such as CoreFiling, W3C XML Validator, etc.
XML is a very vital tool in relation to the development and use of applications across different platforms, either within a local network or a public one, such as the Internet. It is one language that can easily and effectively communicate with applications from different vendors; storing, transporting and sharing data between them. It is universal, portable and easy to use.
However, due to the limitations of XML, the use of XML should be within a scope. In relation to full-fledged relational databases such as Oracle, MSSQL, MySQL, etc it does not compare to them in terms of database elements.
From the writerâ€™s view, XML is best suited to be used as an intermediary between applications for data storage, transport and sharing and also for small-sized, single-user applications.
- By: Segun Adedugbe (Consultant, Cittrex)