Tuesday, August 22, 2006

XML : A Primer by Jaymin kansara, Ahmedabad, Gujarat, India

Extensible Markup Language lets you structure data in documents, unlike HTML

If you keep an eye on Web Development technologies and trends, you would have heard about XML(extensible markup language). xml has taken the web development world by storm.
This piece will introduce you to the technology and how it's implemented. I will use comparisons with HTML wherever possible to help you understand the concept.

what is xml?

One of the first things to realize about xml is that it's not a language per se. Although called a 'markup language', it's actually a Meta Language, which means that xml has only syntax (the grammar) but no keywords, programming constructs, etc. It actually defines 'rules' that lets you structure other markup languages. HTML, on the other hand, is a markup language with a fairly well defined set of keywords.

so what does xml do? xml lets you define the structure of documents rather than how they look(which is what html does). This structure definition makes it easy for the document to be reused and viewed in different ways. By separating the content and structure of the document from its look and feel, you can make your document available to different viewers without having to worry about creating a version for each.

A typical example would be the (very painful) requirement of web developers having to make sure their html pages look the same on every major browser. With xml, all they need to create is the document structure, and let the browser worry about formatting the document. yes, i know this sounds great, but the bad news is that no current browser is capable of doing that yet. Version 5 of both IE and netscape promised to provide xml parsers. (Incidentally, ie 4 already has two parsers, one in c++ and the other in java.)