With this, I am starting a series of post on QTP and XML. To set the tone for discussion, I would start with the basics of XML and the differences between XML and HTML.
What is XML?
XML is a markup language much like HTML. The prime use of XML is to store, carry, and exchange data. Being hardware and software-independent, XML has been widely accepted (W3C standard) as the means of data exchange between disparate systems.
XML does not really do anything – it only structures, stores or sends information.
For example, this is a note stored as XML:
- <from>Thomas Vinod</from>
- <body>XML and QTP</body>
The note has a header and a message body, sender and receiver information. Nevertheless, this XML document is nothing other than well-formed data. Someone must write a piece of software to send, receive, display or interpret it.
Software that can handle plain text can also handle XML. In a simple text editor, the XML tags will be visible. In an XML-aware application however, the XML tags can be handled specially (may or may not be visible, or have a functional meaning).
XML vs HTML :
HTML describes presentation. It is used to display data and focuses on how data looks. For example, in the HTML below, Bibliography is the header, the rest of the text is in paragraphs with the text with <i>..</i> is italicized.
- <h1> Bibliography </h1>
- <p> <i> Foundations of Databases </i>
- Abiteboul, Hull, Vianu
- Addison Wesley, 1995
- <p> <i> Data on the Web </i>
- Abiteoul, Buneman, Suciu
- Morgan Kaufmann, 1999
XML describes content. It is used to describe data and focuses on what data is.
For example, in the XML below, bibliography is an element with child element books.
- <book> <title> Foundations… </title>
- <author> Abiteboul </author>
- <author> Hull </author>
- <author> Vianu </author>
- <publisher> Addison Wesley </publisher>
- <year> 1995 </year>
HTML can also use XML for storing its data and concentrate on the presentation, so that changes to data do not affect the HTML. In that sense, XML is a complement to HTML, it is not a replacement for it.