Strategic Web Usability

XML debabbled

I'll be moving away from Java-related topics this week and into a mix of website development technologies. I should probably say out loud that my plan has been to essentially cover a lot of the internet basics at first and gradually move into the more cutting-edge stuff. You should see more of the "new" stuff over the next couple of months. I've got a decent laundry list of topics, but please feel free to suggest any topics (just email the blog address) that you'd like to see debabbled. In the meantime, on to this week's topic, XML.

What is XML?
It may help to know that the "ML" in XML is the same one as it's cousin, HTML. XML and HTML are both Markup Languages, essentially sets of "tags" that are used to help the reader (be they man or machine) sort out how a document or file should be interpreted. In the case of HTML, the tags generally describe rules for displaying the information. XML, on the other hand, is generally used to describe data.

Technically, XML stands for eXtensible Markup Language. Unlike HTML, which has a set library of tags with specific meanings, XML can be extended to describe many different types of information. Practically speaking, XML tags essentially give meaning or context to the data in a file. So, for example, let's say you received the following simple data file:

Smith, lawyer, 58, Rabbit
It's a pretty safe bet that this represents a person and that the first two bits or "fields" of information are telling you the person's last name and occupation. After that, it gets a bit dicier. The third column could be the person's age or perhaps their salary (in $1,000's). The last column could be their category of pet or the car they drive. What if the file itself helped you sort all of this out? It might look something like this:

<customer>
   <lastName>Smith</lastName>
   <occupation>lawyer</occupation>
   <age>58</age>
   <carModel>Rabbit</carModel>
</customer>
Sure, it's a bit longer, but now instead of having to make assumptions, you can easily figure out the intended structure of the data. Although it's a bit of an oversimplification, the second example is essentially an XML file.

What's in it for me?
The internet is all about standardizing the way information is communicated, and that standardization has made it possible for servers, websites, software, etc. to more easily share information and resources. Unfortunately, these entities often continue to speak their own language, and the languages used to describe data can be extremely complicated and proprietary. XML has created a way to standardize the way web-based entities share data, wrapping up raw data and the rules for interpreting it into one reasonably neat package. These days, most of the major scripting languages and database engines (e.g. Microsoft SQL, Oracle, etc.) support translation to and from XML, and it is the obvious choice if your website or web-based application needs to talk with other websites or outside resources.

©2012 User Effect, Inc. · Home · About · Services · Contact · E-book · Blog · Archive