This article is an introduction to XML. Here we will learn what is XML? Why XML was developed when there is HTML? and some brief history about XML.
SGML is a meta-markup language which is a language for defining other markup languages. SGML was the basis for the development of HTML in 1990. In 1996 W3C started work on developing another meta-markup language called XML (eXtensible Markup Language).
The motivation for developing XML was due to the deficiencies in HTML. One deficiency is, HTML is a markup language for describing the general form layout of information in a web document. It doesn’t describe the meaning of information in the web document.
For example, if a web document displays students information from different branches, there is no way to identify all the students that belong to CSE using the tags and attributes in HTML.
Another deficiency in HTML is, it enforces few restrictions on the arrangement and order of tags in a document. For example, an opening tag can occur within the content of another element, but its corresponding closing tag can appear after the end of the element in which it is nested as shown below:
<p>This is <b> a paragraph </p> </b>
One solution to the deficiencies in HTML is to develop a markup language with its own set of tags and attributes for each set of users with a common need using SGML. As SGML is quite large and creating a parser that understands SGML is complex, this solution is not feasible.
Another solution to the problems in HTML is to develop a simplified version of SGML that allows the users to describe the data in the document. That simplified version of SGML is XML which is a meta-markup language that was developed to describe the meaning of data in a document. XML doesn’t include any predefined tags. It specifies rules for creating user-defined tags.
XML is not a replacement to HTML. Both of them have different goals. HTML is a markup language for describing the form and layout of the information in a document. XML is a meta-markup language which specifies rules for creating user-defined tags (markup) and attributes for describing the meaning of the information in a document.
XML provides a simple and universal way to store any textual data. Data stored in XML documents can be distributed electronically and can be processed by any application. It is easy to write applications that can process XML documents as data in a XML document is stored in a standard way. That is why XML is a universal data interchange language.
Unlike (X)HTML, XML doesn’t describe the basic presentation details of the information in a document. So, a browser renders the content of an XML document as plain text. To specify presentation details we have to use CSS or XSLT.
Applications processing a XML document should analyze the document to obtain information like tags, attributes and data strings. This task of parsing and analyzing is done by XML processor.