Wednesday 16 January 2013

The XML Superstore(r)

XML coding, unlike HTML, is used to help store and transport data rather than just describe it. To give you a clearer idea, it works a bit like a library cataloguing system, or even isles in a superstore. (I use the more American term purely because it contains the word "store" which is what XML does best.) Imagine you own a superstore; you get to pick exactly what goes in what aisle, what shelf, even what inch. XML works in a very similar fashion, as there are no set words you must use to define the items, but you do have to tell label the information using "< >" and "</>" so that the computer knows what items are the same and need to be grouped together. Now imagine you want to set up a new shop, or move location; because you know exactly what goes in what aisle and on what shelf, you can move stuff in quickly and it will look exactly the same. This is how XML data works, because everything is tagged nothing gets lost when you transfer the data or copy it. However, your coding has to be perfect for it to work correctly.

XML is frequently used in the publishing industry, business documentation and databases as it is easy to understand. Both coding and content are readable for the user. There is a logic to the coding that is fairly easy to grasp, because it is mainly user defined. For example, even when the data only needs to be understood by the computer, we can still understand what it is:

<item number="00001">
  <name>
    <first>Jane</first>
    <middle>Q</middle>
    <last>Public</last>
  </name>
  <phone type="voice">
    <areacode>407</areacode>
    <number>555-1212</number>
  </phone>
  <phone type="fax">
    <areacode>407</areacode>
    <number>555-1213</number>
  </phone>
  <email>jpublic@gmail.com</email>
</item> 


(Source)
 
If we read the tags we can work out quite easily that this is "Jane Q Public's" contact information, and that she is the first in the database. XML is great for this type of information, as you only need a name, number, or email address to find out the rest of the persons information because all of the information is grouped.

Essentially XML is a great method of organising data. It's easy to understand, things within the code are much easier to find, and because everythings tagged and grouped it's very difficult for something to go missing when you want to transfer the file. It's not hard to see why it's becoming more and more popular.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.