Tech. Board
Introduction to XML
Supreeth P (Final Year ECE)
Objectives:
ð* Introduction to XML?
ð* Why not SGML
ð* What is XML
ð* Why XML?
Markup is not a concept that evolved with HTML or the World
Wide Web. It was there, right from the time the print industry
evolved. Every time a reporter submitted an article, the
Editor or the Sub-editor used to go through the matter and
then they used to make certain markings on the text. These
markups used to indicate to the typesetter which part of the
text will be printed in bold, which part will be printed in
Italics and which part will be made a heading or a
sub-heading. In short, markups were used to describe how the
information is to be displayed.
When Tim Berners-Lee conceived the World Wide Web, he needed a
language that would be useful to display information on the
Web. That is why the Hyper Text Markup Language was developed.
HyperText Markup Language as we all know is nothing but a set
of tags with the help of which content of web pages can be
dressed up in such a way that it becomes readable by a
browser.
In the olden days, when web pages were few, the limited HTML
tags were all right. But as the number of web pages on the web
went on increasing it became increasingly difficult to squeeze
data within a given set of tags. Also it was very difficult to
search for data given the generalized nature of the tags and
the large amount of information on diverse topics available on
the web.
Every time a browser encounters a tag, it reads it, interprets
it and renders the text accordingly on the screen. Now how
does a browser understand the meaning, properties, attributes
and values of every tag? This is done with the help of a
Document Type Definition, which is built into the browser.
Every time the browser comes across an HTML tag it refers to
this DTD to understand the meaning of the tag and then renders
the text accordingly on the screen. The World Wide Web
Consortium better known as the W3C has defined the various
HTML tags and their meanings. All the browsers recognize these
tags. However, there are certain tags, which are proprietary
and are not recognized by all the browsers. For example, the
<MARQUEE> tag is recognized by Internet Explorer but not by
Netscape Navigator. Similarly, the <BLINK> tag is supported
only by Netscape Navigator and not by Internet Explorer. These
kind of proprietary tags kept causing cross-browser
compatibility problems. So how does one take care of such
problems?
It was because of all these problems faced that a need was
felt for a language that will allow you to create your own set
of tags and define their attributes, meaning, behavior. XML
helps you to do exactly this. It is a language that helps you
to define your own tags. As we go ahead we will get an
overview of the various aspects of XML.
ð* What is XML?
Extensible Markup Language (XML) is a meta-markup language,
which provides a format for describing structured data. This
makes possible precise declaration of content and also makes
web content more searchable. XML allows you to create your own
set of tags for describing data. HTML is used for displaying
data while XML is used for describing data. Let us understand
this with an example.
<B>THIS TEXT IS IN BOLD</B>
<I> THIS TEXT IS IN ITALICS</I>
The tags given above are HTML tags. The <B> tag tells the
browser that the content of this tag is to be displayed in
bold and the <I> tag tells the browser that the text is to be
displayed as italicized. In other words, the HTML tags tell
the browser how the text is to be displayed. On the other hand
XML tags will look something like this.
<PERSONAL>
<NAME> SANKALP </NAME>
<AGE> 22 </AGE>
<COMPANY> CLARIENT </COMPANY >
</PERSONAL>
As you can see here the tag <NAME> tells the browser that the
content given within it is the name and the content of the AGE
element is the age of that person.
This makes it much easier to search data over the web as tags
take on a specific meaning. In the above case, when a search
engine comes across the number 22, it knows, because of the
tags surrounding it that the number 22 represents age and not
someone’s roll number. Given the number of irrelevant results
that a search engine returns for every search query entered,
this benefit itself should present a strong case in favour of
XML.
Also to an extent it would help to solve the problem of cross
browser compatibility. This is because the meaning,
attributes, possible values etc. of each tag and the structure
of the document is defined within a Document Type Definition
which the browser can refer to before rendering the text. This
makes the page browser independent to an extent because the
browser does not have to refer to it’s own Document Type
Definition for understanding the tags as is the case while
reading HTML files.
XML provides you with one more advantage. It allows you to
separate the presentation from the data. The XML file is only
used to store the data. The presentation is defined in a
separate file called a style sheet, which is stored with the
extension ‘.XSL’. This helps us to separate data from the
presentation. In the olden days, when the Internet had just
started it was only used to transfer text based data. But as
the WWW came into the picture it became possible to add
multimedia features to the web pages. It was because of this
that the World Wide Web started gaining popularity among the
masses. Media companies realized the tremendous potential that
the web held as a mass medium and started using it as a
channel of advertising, entertainment as well as information
transfer. As professional media companies got on to the web
the presentation gained as much importance as the information.
Nobody came to a web-site to read realms and realms of text.
Information had to be presented in a very interactive and
attractive manner. The look of the site gained importance. Web
designing became a professional job, which required a
specialist Graphics designer, specialist content writers, web
page developers, web programmers etc.. As the amount of work
increased it became increasingly necessary to separate content
i.e. data from the presentation. XML allows you to do exactly
this.
XML also makes data shareable between applications. This is
because the structure of the document is stored in a separate
file in the form of a Document Type Definition or a Schema.
Once this structure is known anybody can write an application
to read this data, understand it and can also define his own
stylesheet to present this data in a different manner. This
feature would make data easily shareable between applications.
The benefits of using XML between computer systems and
businesses are probably the greatest and easiest to achieve:
XML allows businesses to define data formats in XML, and
easily build tools which read data, write data and transform
data between XML and other formats. This has allowed a number
of businesses and industry consortiums to build standard XML
data formats. Areas such as Electronic Data Interchange (EDI),
inter-bank payments, supply-chain, trading, and document
management are all the subject of ongoing XML-based
standardization by industry consortiums.
|