XML stands for Extensible Markup Language. As its name suggests, it is a markup language like HTML. Whereas HTML is used to control how data is displayed on screen, XML concentrates on transporting and storing the data, with a focus on what the data actually is and its format.
The most prominent feature of XML is that it does not have predefined tags. Some might call this a drawback, suggesting that the lack of defined structure can lead to confusion if care and organisation are not present. For most developers, however, this is an advantage – rather than having to wait for browsers and standards bodies to accept tag set enhancements (as is the case in HTML), we are free to create our own tags at our own pace, and evolve them as we see fit.
It is from these custom tags that XML’s greatest advantage over HTML can be appreciated. To display customer information on a page in HTML might look like the following:
<li>First Name: Chris</li>
<li>Street Address: 123 Wall Street</li>
<li>Postcode: TA1 3FA</li>
In XML it might look like this:
<address>123 Wall Street</address>
With HTML, the Graphical User Interface (GUI) is embedded in the actual data. Should the display format of the data need to switch – from its current list format to a table, for example – the entire HTML needs to be re-coded. XML, on the other hand, is told how to be displayed by a separate styling sheet (an .XSL file). To change from a list format to a table would require only a small change to this separate file.
As every single bit of data in XML is categorised into the developer’s custom tags, searching through it becomes easy and efficient. For example, using the custom XML format defined above, a search for customers who are based in Taunton would be easy as the developer knows that each customer has a <town> value, and it is merely a case of limiting the search to the values within this tag. As a relationship has been already been defined between the customer’s town and their other data, it is just as easy to return other information from the customer once they have been identified. This kind of functionality just isn’t possible in HTML.
Another great strength of XML is that it is environment-independent. To move HTML into a Java applet, for instance, would require the stripping of HTML tags and a reformat of data. With XML, however, complex relationships and a common structure within the data has already been established, and can easily be inherited by the new environment. This XML compatibility holds true with a large proportion of development environments.
Finally, as XML is self-describing, it is far easier for a new developer with no prior knowledge of a product to understand. For example, the meaning of XML tag <id>003</id> is obvious, whereas its HTML equivalent, which might look like <li>003</li>, is not so clear.