Today your Web browser speaks XML, tomorrow your cell phone will—with your television, car, and doorbell set to follow. Although XML is about as banal a technology as can be imagined, every geek in the world believes XML will become utterly pervasive and change the world. Why all the Xcitement?
XML (extensible markup language) is simply an agreement among programmers about how to represent and exchange data. (Yawn.) In computerese, such an agreement is called a standard. If you’ve ever tried to import a WordPerfect file into Microsoft Word without the right filter, or beam your phone number from your PalmPilot into somebody’s Pocket PC, you’ve already experienced the frustration of life without standards. It’s maddening, it cuts into productivity, it costs money, and it’s got to stop. The cure is XML, the programmer’s new lingua franca. (Full disclosure: Microsoft, which owns Slate, is backing XML to the hilt with its Microsoft.NET initiative. But so is IBM, Microsoft’s arch-rival. Standards make for strange bedfellows.)
XML is related to HTML (hypertext markup language), the very simple standard language for Web pages introduced by Tim Berners-Lee in 1991. HTML can lend additional meaning to the text displayed in a document, specifying the type size and color of text—and whether or not it blinks. But the XML standard, which is governed by the same nonprofit that governs HTML standards, makes it possible to provide an almost infinite array of additional information. Does this block of numbers represent figures from a database or is it baseball batting averages? Does this block of text denote the name of a person or a city? With XML, you can add that additional information and much, much more.
To understand how XML does its magic, let’s look at some raw HTML and see how it works. (You can look at the raw HTML of any Web page by clicking View on your browser bar, and then clicking Source or Page Source.) For example, the HTML snippet “Read Slate ” would indicate that the text between the “tags” should be emphasized and make it appear in italics like this—Read Slate—when viewed with the graphical browsers from Netscape and Microsoft.
XML tags, on the other hand, make the document smart by indicating what the words mean. For instance, an XML-based inventory file at a car dealer might list a 1999 black Chevrolet Corvette like this—
—so any device or application reading the file could use its own rules to display the data to suit the user. I say “might” in this example because XML is so general-purpose that the tags are not yet universal. One car manufacturer might use the tag
Slate already uses XML extensively, assigning Slate-specific XML tags to each part of an article (headline, subhead, author, date published, footnote, etc.). This makes it easy to build an HTML page for the general Web audience. But by manipulating that XML file with a simple software program, Slate builds a text e-mail document that deletes the illustrations and ads but preserves the context of the headline, subhead, author, and body of the article. Similarly, Slate uses XML to produce an eBook version for the Microsoft Reader, a version of the Today’s Papers for PalmPilots and Pocket PCs, and audio files that speak to the reader. If a popular new medium emerges—skywriting for example— Slate could simply buy a copy of XML SkyWriter 1.0™ and inscribe its stories on the skies. (To view the XML version of a recent Slate“Sports Nut” column, click here.)
Standards tend to build on standards, and a whole slew of them have emerged that build on or support XML. For instance:
- XSL (“extensible style language”) files give readers near complete control over how their computers display XML files. Using XSL, a future version of Slate could allow readers to configure their browsers to display stories in the font, text size, and line spacing they want, not the one our design director has chosen.
- The XML-based standard called SOAP allows computers to communicate directly. Slate could use SOAP to keep a story about the economy eternally up to date by automatically reaching across the Internet via SOAP for the ever-changing numbers from a U.S. government budget database.
- VoiceXML is a standard for vocal communication to and from computers. When you call up the library and ask a computer to read you an article, VoiceXML will be smoothing the way.
Programmers have always wanted to make data move seamlessly from application to application, from device to device, and from organization to organization, but until XML we just couldn’t learn to get along. By toppling this tower of Babel, the superheroes of software have laid the groundwork for your GPS navigation system to converse with your address book, your VCR to maintain a working relationship with your calendar, and your cell phone to boss your thermostat around. All Praise XML, the file format that will save the world!