An introduction to XML


XML stands for eXtensible Markup Language. Like HTML tags, XML tags are enclosed inside brackets. Browsers do not display anything enclosed inside these brackets whether they are HTML or XML. Instead, it uses them to understand what you want to with the text or data between them.

The two main differences between HTML and XML tags

Image Credit

Firstly HTML commands, or “elements”, are pre-defined in the specifications of the HTML mark-up language – especially the HTML5 specifications introduced in 2008 and 2014. The meaning of “header”, “body”, “img”, “href”, “div” and so on cannot be changed, although you can adjust how things look by defining additional styles.

In contrast, XML elements have no pre-defined meaning whatsoever. You need to write code somewhere to tell either the web server or browser what to do with their content. Usually commands intended for the server are written in a scripting language such as PHP, Python or Ruby while those intended to execute in your browser may be written in Javascript, VBScript or Flash.

The other main difference is that content between HTML tags is intended just for display on the web page, but you have a free hand when you write code to act on the data between XML tags.

How XML is used

Image Credit

For example, if you have a lot of names and addresses you could tag them all as “name” or “address” elements. You can then treat each kind of information differently. You might want to export them from the different fields of a database, or export them to different rows and columns in a spreadsheet.

Importing and exporting data between web pages and browsers, and between one file format and another has been a challenge since personal computers first appeared. For example, PDF files are an excellent means of distributing permanent documents to colleagues or readers, but getting data out of them to use in other documents or programs used to be very difficult without expensive software. Today, you can convert PDF to Excel or between many other formats simply by uploading them to a web page such as

XML files are still just plain text files but with tagged data. They make it easy to convert, store, transfer or process data as you choose. You can use them in web pages, spreadsheets, databases and many other applications.

Written by suNCh8

Leave a Reply