HTML In XML

XML is conceived of as a way to extend the power of online delivery of information. Although both XMLand HTML are derived from SGML (Standard Generalized Markup Language), there are important differences between the two markup languages. For one, HTML provides a fixed set of tags, while XMLenables users to define the tags that they need. For another, HTML primarily describes how information should be rendered; it does not lay out what the information is or how it is structured.HTML is about information display or presentation, whereas XML concentrates mainly on structure of the information.
 
In contrast, XML provides information about structure and syntax. (Directions for formatting are included in a separate stylesheet attached to the document.) Whereas HTML is meant only to be used for presentation of documents in Web browsers, XML has wider applications. Not only can it be used for the web, but also as a storage format for word processors, as a data interchange format, and as a preservation format that is readable by humans users.
 
Let’s make this more concrete by looking at an example, here a tutorial record:
 
HTML Version
 
XYZ Kumar
Anatomy of XML
XML guide for Developers
eBIZ.com Pvt. Ltd.
 
The HTML code looks like this:
 
<HTML>
<BODY>
<B>XYZ Kumar</B><BR>
<I> Anatomy of XML </I> <BR>
XML guide for Developers <BR>
<b> Company : eBIZ.com</b>
</BODY>
</HTML>
 
 
XML Version
 
In contrast, XML enables you to describe the specific components of a document or database
 
<?xml version=”1.0″ encoding=”ISO-8859-1”?>
<tutorial>
<author>
XYZ Kumar</author>
<title>Anatomy of XML</title>
<subtitle>XML guide for Developers </subtitle>
<company>eBIZ.com Pvt. Ltd.</company>
</tutorial>
 
 
To achieve the same online presentation, the XML document would be associated with an XSL stylesheet like the following:
 
<?xml version=”1.0″?>
<xsl:stylesheet xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”>
<xsl:template match=”tutorial”>
<html><body>
<xsl:apply-templates/>
</body></html>
</xsl:template>
<xsl:template match=”author”>
<p><b><xsl:apply-templates/></b></p>
</xsl:template>
<xsl:template match=”title”>
<p><i><xsl:apply-templates/></i></p>
</xsl:template>
<xsl:template match=”subtitle”>
<p><i><xsl:apply-templates/></i></p>
</xsl:template>
<xsl:template match=”company”>
<p><xsl:apply-templates/></p>
</xsl:template>
</xsl:stylesheet>
 
 
The Main Difference Between XML and HTML
 
XML is not a replacement for HTML, it is a complement to XML.
 
Both, XML and HTML were designed with different goals:
 
XML was designed to describe data and to focus on what data is. That is, structure of data.
HTML was designed to display data and to focus on how data looks. That is, presentation of data.
HTML is about presenting information, while XML is about describing information.
 
XML was designed to carry data and HTML was designed to display the on user’s browser window. HTML does not know anything about data, and its structure and XML does not know anything about how to present the data.
Scroll to Top