Extensible Markup Language or XML (http://www.w3.org/TR/REC-xml/) appeared as a recommendation of the World Wide Web Consortium (http://www.w3.org) in early 1998. XML is a restricted subset of Standard Generalized Markup Language or SGML (ISO/IEC 8879). By some grace, XML has enjoyed considerable popularity and has been almost universally received as an interoperability solution for heterogeneous computer systems. Although not without shortcomings, XML is probably the best thing we have going for us to deal with software interoperability issues, mainly because of its wide acceptance and presence.
Today, you can find XML just about anywhere you find software. To name a few examples:
OpenOffice’s file format [Hack #65] consists of a set of ZIP-archived XML files.
Mac plist configuration files [Hack #44] are also written in XML.
Web pages now increasingly use Extensible Hypertext Markup Language (XHTML), an XML version of HTML.
XML User Interface Language (XUL) is a Mozilla project that allows you to define applications with XML (http://www.mozilla.org/projects/xul/). Likewise, Extensible Application Markup Language (XAML) is an XML-based language for defining user interfaces for the Avalon framework, part of Microsoft’s upcoming release of Windows code-named “Longhorn” (http://msdn.microsoft.com/longhorn/).
XML is by no means a panacea for all the ills of interchange, but it’s becoming an increasingly practical option for packaging and moving data in and out of systems or for representing data in a consistent, readable way. And it can be fun to use, too, as many of the hacks in this book demonstrate.
The XML specification defines a syntax for creating markup. Markup consists of elements, attributes, and other structures that allow you to label documents and data in a way that can give them meaning that other human beings or software can understand and interpret. Because reliable XML parsers are readily and often freely available in a variety of programming languages, it is relatively easy to integrate XML processing into just about any application.
This book’s mission is to give you a running start at doing many of the things that are commonly—and sometimes uncommonly—done with XML. While you’ll find beginning, intermediate, and advanced hacks between the covers, this book is not an exhaustive treatment of everything you can do with XML. Instead, it focuses on the mainstream, core tasks found in XML territory. These tasks can be accomplished quickly and usually use downloadable, open source software or software that is available for free trial.