XML stands for Extensible Markup Language, which is a markup language similar to HTML (Hyper Text Markup language). XML is designed to describe data. XML focus on what the data is that had been described. As compared to HTML, XML tags are not predefined and the developer can create their own tag for describing of data. XML uses a Document Type Definition (DTD) or an XML Schema to describe the data. It is designed to be self-descriptive with a DTD or XML schema. It became W3C recommendation on February 1998 (www.w3schools.com).
When one looks any HTML document than they observe some differences between XML and HTML. The main difference between XML and HTML is that they are defined with different goals. In case of XML, it is designed to describe data and to focus on what it is. However, in case of HTML it is designed to display data and to focus on how data looks. HTML is about displaying information, while XML is about describing information. Therefore, XML cannot replace HTML but provide useful features that can be useful for web development. Some facts about XML are given below:
· XML is free and extensible, means developer can invent their own tag and document structure for describing of data.
· XML is a complement to HTML. Moreover, Defining HTML as XML application is called as XHTML (Extensible Hyper Text Markup Language).
· XML is platform, software and hardware independent language/tool for transmission of data/information.
· XML can be used as common tool for all data manipulation and data transmission for future web development with HTML.(www.w3schools.com)
According to Thangarathinam (2006), XML had an impact across a broad range of areas and some are given below:
· XML documents can be easily read and understands by human. Therefore, in worst cases, it can be read and figure out the content by someone, which is not possible with binary data formats.
· XML is widely supported by industry these days. Numerous tools and utilities are being provided with Web browsers, databases, and operating systems. This makes XML easier and less expensive for small and medium-sized (SME) organizations to import and export data in XML format.
· The .NET Framework has XML support available everywhere in the framework.
· Relational databases have capability to store, read and generate XML data. Recently IBM has launched DB2 Viper for XML data type and Microsoft SQL Server 2005 supports XML data formats.
· There are large number of technologies exists for the interpretation and transformation of XML data for Web page display and report generation. (Thangarathinam 2006, p. 21)
Many of the XML technologies are used in .NET Web Applications. Some of the important XML technologies that are essential to the understanding and development of XML-based ASP.NET Web applications are DTD, XDR (XML Data Reduced), XSD (XML Schema Definition), XSLT (Extensible Stylesheet Language Transformations), XML DOM, XPath, SAX (Simple API for XML), XLink and XPointer and XQuery. Figure 1 shows the .NET Framework architecture in which XML classes are used that enable developer to work with data in a variety of formats.
Figure 1: NET Framework architecture (Source: Bornstein 2003)
Examples of XML
1. A simple XML document: A simple email message format.
<Body>Hi, how r u? </body>
2. A XML file named “countries.xml”: this is the file that stores Countries name (text) and abbreviation (value).
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
3. A XML Namespaces: Below example uses XSL which is the preferred style sheet language of XML.
<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<h2>My Book Collection</h2>
<xsl:for-each select= book”>
4. Bind a DataSet to a List Control in ASP.NET: Initially the “System.Data” namespace is imported for working with DataSet objects. Then a DataSet is created for the XML file that loads XML file (“countries.xml”) when the page is initially loaded. The DataSet, bind with RadioButtonList Control for displaying the results of user clicks.
<%@ Import Namespace=”System.Data” %>
if Not Page.IsPostBack then
dim mycountries=New DataSet
sub displayMessage(s as Object,e As EventArgs)
lbl1.text=”Your favorite country is: ” & rb.SelectedItem.Text
<asp:RadioButtonList id=”rb” runat=”server” AutoPostBack=”True” onSelectedIndexChanged=”displayMessage” />
<p><asp:label id=”lbl1″ runat=”server” /></p>
Thiru Thangarathinam. Professional ASP.NET 2.0 XML, United States of America: Wiley Publishing, Inc., 2006
Niel M. Bornstein. .NET and XML, United States of America: O’Reilly ; Associates, Inc, 2003
Elliotte Rusty Harold ; W. Scott Means. XML In A Nutshell: A Desktop Quick Reference, United States of America: O’Reilly & Associates, Inc, 2001
http://www.w3schools.com/xml/default.asp accessed on April 1, 2007.