1. Technology
Send to a Friend via Email
Why Learn XML?
I already Know HTML, Do I Really Need Another Language?
 Join the Discussion
"how do I integrate an XML feed into a Web site?"
  Related Resources
•  Beginning XML
•  What is a DTD?
•  What is XML?
 From Other Guides
•  XML / XHTML Learn to design Web pages the right way

By Jennifer Kyrnin

What's the point of learning XML when you already know HTML? Well, the reality is that there are many applications that, while they can be done with HTML, DHTML, Java, ASP, or CGI, work much more easily as an XML application. For example:

  • connecting databases and the Web
  • displaying the same data in multiple formats
  • information tailored to fit the needs of the reader
  • moving the processing load from the Web server to the client

One thing to keep in mind is that XML is not as hard as you might think. If you know HTML, XML is not difficult to learn. And there are, as I said above, many things that XML can do much better than HTML.

Connecting Databases
The way most people connect databases to the Web is with some external program such as a CGI script, PHP, or ASP. But the data itself is not defined as a database entry until it is actually in the database. If you use XML to connect your databases to the Web, once the data is entered into XML it is in a format compatible with the database.

The reason you can enter data that is compatible with the database and with your XML document is because of the second benefit of XML over HTML:

Multiple Data Formats
Often XML documents can be thought of as a structure for data. Each data element is labeled in such a way that a computer can recognize what it is. For example, if you enter an address book into XML, you would perhaps define the following data groups:

  • name - first, middle, and last
  • address - street, number, and apartment or suite
  • city
  • state or province
  • postal code
  • country

If you have an XML application that accepts data into each of those data groups, you can then create a form to print the data on an envelope, create another form to write all the entries in an address book, and place a final form to keep all the information in a database. With one entry of the data, it can be used for three different applications.

Tailored Information
Documents written in XML can be more easily tailored to be viewable in various formats. To go back to HTML, if you create a document with headings <h1>, <h2>, and <h3> you have a generally good idea of how they will look on a Web page. But if you were to try to view those headers on a WAP phone you might be surprised how they looked (if they displayed at all).

If we go back to our XML enabled address book, we can use that XML data to display it on the WAP phone and the Web page. We can use a scripting language to determine what is viewing the data, and if it's the WAP phone - display the address book using WML and style sheets, and if it's the Web page - display it using XHTML. But we don't have to create two separate documents. We simply create rules for how the data will be displayed in WML and XHTML and have the pages dynamically built from our XML enabled database.

Load Distribution
One really good feature of XML is that it can be used along with Java and other tools to move most of the processing from the server to the client itself. For example, if you take your address book XML document, you can pass it to a Java applet that will search through the address book fields. But all the processing of both the data and the searching is done by the Java application on the client side rather than the server side. This means that an XML and Java enabled server can process more documents than one that must do the searching itself.

Learning XML or HTML?
Choosing to learn XML is a choice you need to make for yourself, but there are many things that XML can do much more effectively than HTML. If you learn XML, you will have the advantage of a powerful tool in your repertoire to create and manage data.

Previous Features

©2014 About.com. All rights reserved.