- slide 1 of 5
XML Versus HTML
XML and HTML are siblings, yet they are very different. Like HTML, XML is text-based, and uses tags, elements, and attributes. However, the focus of HTML is on the display of content, whereas XML is designed to emphasize the content itself. Because HTML's strength is in displaying and formatting information, you are not able to use it for creating or modifying content like you can with XML. Neither is it extensible in the way XML is, because you cannot add tags.
- slide 2 of 5
For example, how would you code a catalog of books in HTML? Perhaps you would use a table:
<TD>Honore de Balzac</TD>
The HTML document presents the data in rows and columns, and we may easily add extra formatting to control font size, cell color, and other markups. The tags format the information, but cannot describe it, and are incapable of being altered to meet specific requirements. Additionally, they are the same for every document.
Consider the same information displayed in XML format:
<AUTHOR>Honore de Balzac</AUTHOR>
In contradistinction to the HTML code above, the XML document is focused on adding structure to the data in the form of elements. The elements describe what the data actually is. We know that our document must be a book catalog and that it must specify authors and titles.
- slide 3 of 5
An Example Using Lists
Now let's consider a list with a partial table of contents rendered in HTML:
<H2>Tales of Unrest</H2>
<LI>Karain: A Memory</LI>
In XML, one solution from many possibilities could be:
<TITLE>Tales of Unrest</TITLE>
<CHAPTER>Karain: A Memory</CHAPTER>
So we can observe that the main focus of the XML code is on the content, and not on the presentation per se. The presentation of an XML document will be addressed in a future article.
- slide 4 of 5
For Further Reading
The best way to learn XML is by doing as many exercises as possible. Some texts you may wish to consider are:
- XML: Visual QuickStart Guide (2nd Edition) by Kevin Howard Goldberg
- New Perspectives on XML by Patrick Carey
- Beginning XML by Hunter et. al.
- Any book in the Sam's Teach Yourself XML series
Many of these may be found in the library. Library systems usually offer free access to databases such as Safari Books Online, which carries complete versions of some XML texts.
- slide 5 of 5
- Tim Bray, who wrote the 1998 XML specifications and is of Sun Microsystems, has a blog where he expresses his dissatisfactions, hopes, and dreams for XML. Type "XML" into the search box to pull up relevant articles