Web Design Basics: What Is Xml And What Is It Used For?

XML is a simple language with limitless potential. Learn its purpose and how it can help you develop your applications faster and make them interoperable.

XML (eXtensible Markup Language) is an exciting web technology which can help you accomplish a variety of complex projects with ease and elegance. First formalized by the World Wide Web Consortium in 1998, XML looks similar to the widely-known HTML. However, the two languages can have very different uses.

Like HTML, XML is a markup language. The main difference is that unlike HTML, XML is not limited to describing web pages. While HTML has a restrictive set of tags that make it particularly suitable for hypertext, XML can support an unlimited variety of tags. This ability gives XML almost limitless applications.

One of the most important features of XML is the Document Type Definition (DTD). DTDs serve to define the tags, attributes and other elements that are allowed in a particular kind of document. Using DTDs, you can set up a format (or "schema") that suits the kind of data you want to represent. DTDs also allow you to validate data you get from other sources, assuring that it is in compliance with your schema. Before you start developing your own DTDs, check online to make sure a relevant standard hasn't already been developed; XML works best when your applications are interoperable with those of your associates.

XML has become an extremely popular format in recent years. For that reason, most every modern programming language supports reading and writing XML. Libraries and modules for parsing XML are almost universally available. In addition, XML is a very portable plain text format. These advantages lead to one of the most important uses of XML: exchanging data between systems such as web applications.

For example, if you are running an online store, you might want to offer your customers a shipment tracking function directly from your website. To accomplish this, your site can communicate with the courier's web application by sending it a request formatted in XML. In return, you will receive the shipment tracking data -- also in XML. This very exchange is happening thousands of times each day on the Internet, and it's only one example of the kind of transactions you can accomplish with XML.

XML has numerous other uses outside of the realm of information exchange. Many vendors are replacing their proprietary file formats with new ones based on XML. For example, there are now XML formats for word processing documents, spreadsheets and databases. Configuration files and other data can also be stored as XML. This allows an unprecedented level of openness and interoperability, since other applications can easily be programmed to read and write your file format.

Last but certainly not least, XML can be used to create web pages. The basis for this functionality is XHTML, which is simply an XML-compliant form of HTML. Converting your HTML documents to XHTML often requires only minor changes. If you decide to convert to XHTML, you can take the opportunity to polish your code and adopt CSS (Cascading Style Sheets), if you have not already done so.

However, just converting to XHTML doesn't bring you the full benefits XML can offer to your web presence. You might also consider using an XML-based templating system such as XSLT to further separate style and content on your website. With XSLT, you can write web documents in a simple outline format and focus entirely on your pages' content. Then, an XSLT template can take your content and fit all of its elements into the correct slots in your styled web pages. Together, XSLT and CSS provide the most complete separation of content and style available on the web today.

Of course, there are innumerable other uses for XML. Thousands of applications are already available online, and many more have yet to be conceived. XML is an exceedingly simple language, and perhaps for that reason has quickly become a leading technology on today's World Wide Web. When you're starting your next project, you'd do well to ask yourself -- How can I use XML to make this project easier, more functional and more interoperable?

© High Speed Ventures 2011