General working of XML

"Consider the modern database: sleek, efficient and able to retrieve records in the blink of an eye. Data representation, management and storage have risen to heights we dared not dream of only 10 years ago. But ironically, despite these achievements, the hippest, most cutting-edge data management technology today is (drumroll please ...) delimited text." [infoworld.com]

XML, eXtendible Markup Language, is the most cutting edge data management technology. It also is just a way of dealing with text files. You start with the information you want to send to somebody else, like this:

Example 4-1. XML example - The plain information without any indication about what it really is

	    
	    List of items

	    roof tiles	450	red rooster
	    wooden planks	20	5x20 cm
	    
	  

The next stage is to "tag" everything in above message, that is, you put a nametag on it. In XML this is done with <nametag>information you want to tag with that nametag</nametag>. So the nametag is enclosed in "<" and ">" signs to form the opening tag, followed by the information and it is closed with a closing tag. The closing tag is the same as the opening tag, only with a "/" before the nametag. Example 4-2 shows how this works out if we change Example 4-1 into an XML format:

Example 4-2. XML example - The same information, now tagged to make an xml file out of it.

	    
	  <orderform>
	  <description>List of items</description>
	  <item>
	  <name>roof tiles</name>
	  <quantity>450</quantity>
	  <type>red rooster</type>
	  </item>
	  <item>
	  <name>wooden planks</name>
	  <quantity>20</quantity>
	  <type>5x20 cm</type>
	  </item>
	  </orderform>
	    
	  

This information can be fed into the company's internal ordering system. For example, by using a PalmPilot to enter the data into an application while walking on the building site. Once a (wireless) connection is made via the Internet to the company's office, the information is send over in XML format and at the office, the ordering system reads the XML file and acts upon it. The interesting thing is that the receiving application now knows whether it is an orderform, a damage report or an timesheet. Also it can distinguish between a typenumber and a quantity.

Sending over information is nothing special. Sending over data in some pre-agreed format is nothing special. The major advantage of XML is that it is a standard. It is a standard way of tagging information with meaning. Almost every computer programming language in existence has got one or more modules to read an XML file, to write one, to change one, etc. On the consumer side, the only thing you notice is an increase in possibilities because it is much easier to (quickly) program additional functionality.