This article will give a brief introduction
to XML.
What is XML?
XML, or Extensible Markup Language, is best described
as a storage facility for static content. Think of
it this way: in many programming projects, first
you set up the structure of your code in your mind,
then write it down in pseudo-code. Pseudo-code is
writing your code in English before writing it in
a specific programming language. XML is the Internet's
version of pseudo-code. The code by itself is nothing
but pure content. However, when parsed with another
language, it can be placed in a usable interface.
It allows you to simply write down what you want
and do it in a neat and orderly matter. XML is more
powerful than just pseduo-code though, because it
allows you to parse the code you write and display
it in a variety of ways.
Is it like HTML?
In plain words, no. Though the syntax may be similar
to HTML, XML and HTML are quite different and each
serves a different purpose. XML is supposed to be
parsed by another language such as PHP, XSL, ASP,
etc. to display as HTML. However, HTML can be thought
of as a pre-written XML with the browser as the parser.
The difference between XML and HTML are that in XML,
there isn't anything thats pre-defined. a <br
/> is not a break line in XML. Everything is new
to XML. Unlike HTML, all tags must be opened and
closed in XML. For example <br />
must be written as <br ></br> and then
in a parser, you have to define to put a <br /> wherever
it sees that code. Also, unlike HTML, XML is case sensitive
meaning <br ></BR> will not work.
What are the advantages of XML?
XML has several key advantages because there is no
other language like it. XML lets you define your
own programming language and gives you extreme freedom
in writing your code. It is extremely easy to code
something in XML. In addition, XML is cross-platform,
meaning it is possible to work in any server from
*nix to NT. XML is very different in the sense that
it is both a client side and a server side language.
When parsed by another server side language, it can
display content in a myriad of ways. It is client
side because if it left byitself, it is still able
to display. In a company, XML easily divides the
job of a web designer and the job of the business
man. The business man only has to write the XML code
with the raw data, and give it to the web designer
who can parse the XML file and display it in a wicked
layout.
Should I use XML?
This is a very interesting question. Many times, you
implement a schema on your website and once you get
it up and running, it is more trouble than it's worth.
XML, unlike other dynamic server side languages,
works better with static content. It is more of a
template system which is used throughout the world
wide web and can fit to whatever you want to store.
For example, all the tutorials in Spoono are stored
in XML pages, one for each tutorial. They store all
information from the image locations to the tutorial
text. Each tutorial is static and isn't going to
change everyday. Also, the Grapevine on Spoono is
saved in an XML file. This is because if other websites
want to display the Grapevine on their page, they
can just make their own parser for the XML and show
it on their website and stay updated. Those are a
few reasons to use XML.
Conclusion
Spoono switched to XML for it's tutorials (This tutorial
was written in XML :) and we feel that it definitely
has made it easier to write a tutorial quickly and
effectively. Extensible Markup Language is becoming
more and more popular in the web community. It is
free, and more and more companies and web developers
are adopting it for their website. It lets you update
your website easily and quickly.
|