It's a fact of life that XML, which stands for eXtensible Markup Language, is invading our lives more and more as programmers, and I feel this is a good thing. The reason being XML has the ability to cross all sorts of boundaries, and probably the only chance we have to obtain a truly independent, cross-platform data transfer format.
What Is Extensible Markup Language: Before we can learn what XML is, it’s a good idea to clarify what markup language is. Because, language is probably the wrong term. It is not a language in the sense that Visual Basic or C++ are languages, but it’s a set of rules that define how text documents should be marked up. Now we have to define what we mean by marked up. Marking up a document is the process of identifying certain areas of a document as having special meaning. In short markup language is just a set of rules that define how we add meaning to areas of a document.
The main difference between XML and HTML XML takes a different view from HTML, although it still uses tags, It is not a replacement for HTML. XML and HTML were designed with different goals. The major difference is that XML is designed to describe the structure of text, not how it should display. In short, XML was designed to carry data, to describe data and to focus on what data is. On the other hand HTML was designed to display data and to focus on how data looks. To put it in a line we can say HTML is about displaying information, while XML is about describing information. Let us take a simple example 1: Save it as .html
<body>
Hello !!
<h1> Welcome to the Web Age. </h1>
This is normal text. <b> while this is bold text.</b>
</body>
When you load the above html file into a browser, then it displays the above tags as though it were formatted document. Which will looks something like below
Hello!!
Welcome To The Web Age
This is normal text. While this is bold text.
However if the above text defines an XML document, then the tag don’t mean anything. Say you load same file with .html extension (example 1) into the browser like IE but now with a .xml file suffix. Internet Explorer interprets this XML and displays it for us which looks like this
<body>
Hello !!
<h1> Welcome to the Web Age. </h1>
This is normal text. <b> while this is bold text.</b>
</body>
But notice it’s done nothing with the XML – just displayed it as such (except indents the tags to give a structured look). The browser knows how to interpret HTML and display it with all formatting. The browser also knows how to interpret XML, but in this case since XML tags don’t imply formatting nothing is done and the tags are displayed as such.