NET Principles and Concepts Essay

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:

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

·   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.

<Message>

<To>Jim</To>

<From>Baker</From>

<Subject>Reminder</heading>

<Body>Hi, how r u? </body>

</Message >

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″?>

<countries>

<country>

<text>Japan</text>

<value>J</value>

</country>

<country>

<text>Sweden</text>

<value>S</value>

</country>

<country>

<text>Belgium</text>

<value>B</value>

</country>

<country>

<text>Italy</text>

<value>I</value>

</country>

</countries>

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″?>

<xsl:stylesheet version=”1.0″

xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>

<xsl:template match=”/”>

<html>

<body>

<h2>My Book Collection</h2>

  <table border=”1″>

    <tr>

      <th align=”left”>Title</th>

      <th align=”left”>Author</th>

     <th align=”left”>Publication</th>

    </tr>

    <xsl:for-each select= book”>

    <tr>

      <td><xsl:value-of select=”title”/></td>

      <td><xsl:value-of select=”author”/></td>

      <td><xsl:value-of select=”publication”/></td>

    </tr>

    </xsl:for-each>

  </table>

</body>

</html>

</xsl:template>

</xsl:stylesheet>

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” %>

<script runat=”server”>

sub Page_Load

if Not Page.IsPostBack then

  dim mycountries=New DataSet

  mycountries.ReadXml(MapPath(“countries.xml”))

  rb.DataSource=mycountries

  rb.DataValueField=”value”

  rb.DataTextField=”text”

  rb.DataBind()

end if

end sub

sub displayMessage(s as Object,e As EventArgs)

lbl1.text=”Your favorite country is: ” & rb.SelectedItem.Text

end sub

</script>

<html>

<body>

<form runat=”server”>

<asp:RadioButtonList id=”rb” runat=”server” AutoPostBack=”True” onSelectedIndexChanged=”displayMessage” />

<p><asp:label id=”lbl1″ runat=”server” /></p>

</form>

</body>

</html>

References:

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.

x

Hi!
I'm Larry!

Would you like to get a custom essay? How about receiving a customized one?

Check it out