Update: The third edition of the XML Bible has been published. This is called the XML 1.1 Bible. I'm keeping this page here to support readers who bought the second edition, as well as for readers of translations, since most of the translations are still based on the second edition. However, if you want the most current information, you should go to the XML 1.1 Bible page instead. It is much improved over the second edition with lots of new and updated material. It's completely up-to-date with the state of the art in XML as of 2004.
When the first edition of the XML Bible was published about two years ago, XML was a promising technology with a small but growing niche. In the last two years, it has absolutely exploded. XML no longer needs to be justified as a good idea. In fact, the question developers are asking has changed from "Why XML?" to "Why not XML?" XML has become the data format of choice for fields as diverse as stock trading and graphic design. More new programs today are using XML than aren't. A solid understanding of just what XML is and how to use it has become a sine qua non for the computer literate.
The XML Bible, 2nd edition is your introduction to the exciting and fast-growing world of XML. With this book, you'll learn how to write documents in XML and how to use style sheets to convert those documents into HTML so that legacy browsers can read them. You'll also learn how to use document type definitions (DTDs) and schemas to describe and validate documents. You'll experience a variety of XML applications in many domains, ranging from push to vector graphics to genealogy. And you'll learn how to take advantage of XML for your own unique projects, programs, and Web sites.
For the second edition, this book was rewritten from the ground up. While I retained the basic flavor and outline that proved so popular with the first edition, the writing has been tightened up throughout. I tried to address all common complaints about the first edition. For instance, the largest examples are now smaller and easier to digest. Where mistakes or misstatements were found, they have been corrected. Most important, the text has been brought completely up to date with the state of the XML world in 2001. Many technologies that were rapidly changing bleeding-edge tools in 1999 (XSLT, XSL-FO, XHTML, XLinks, XPointers, namespaces, etc.), have become the rocks on which future XML technologies are being built. Thus, it is now possible to offer much more comprehensive and final coverage of these, rather than the somewhat tentative first steps I took in the first edition.
The world never stands still for long, however. In the two years since the first edition appeared, new XML technologies have issued forth at a frightening pace. They are discussed here as well, though often with caveats that the details are still subject to change. There are several completely new chapters covering many of these cutting-edge applications, including chapters on:
Even more important than the new chapters are the new sections woven into more familiar chapters. Although I made every effort to write more concisely in this edition (My favorite reader comment about the first edition was, "It would seem to me that if you asked the author to write 10,000 words about the colour blue, he would be able to do it without breaking into a sweat"), I still ended up with a book 300 pages longer than before, and most of those 300 pages are new material scattered throughout the book. If you liked the first edition, I can only surmise that you're going to like the second edition even more. It is in every way a better, more comprehensive, more accurate book. If you didn't like the first edition, I hope you'll find the second more to your taste.
Unlike most other XML books on the market, The XML Bible covers XML not from the perspective of a software developer but rather that of a Web page author. It doesn't spend a lot of pages talking about BNF grammars or parsing element trees. Instead it shows you how you can use XML and existing tools today to more efficiently and productively produce attractive, exciting, easy-to-use, easy-to-maintain Web sites that will keep your readers coming back for more.
This book is aimed squarely at Web site developers. I assume you want to use XML to produce Web sites that are difficult to impossible to create with raw HTML. You'll be amazed to discover that in conjunction with style sheets and a few free tools, XML lets you do things that previously required either custom software costing hundreds to thousands of dollars per developer or extensive knowledge of programming languages like Perl. None of the software in this book will cost you more than a few minutes of download time. None of the tricks require any programming.
XML does build on HTML and the underlying infrastructure of the Internet. To that end, I will assume you know how to ftp files, send email, and load URLs in your Web browser of choice. I will also assume you have a reasonable knowledge of HTML at about the level supported by Netscape 1.1. On the other hand when this book discusses newer aspects of HTML that are not yet in widespread use like cascading style sheets or the <SPAN>
and <DIV>
tags, I will cover them in depth.
To be more specific:
On the other hand, there are a number of things I do not assume you know. In particular:
This book has one primary goal, to teach you to write XML documents for the Web. Fortunately XML has a decidedly unsteep learning curve, much like HTML (and unlike SGML). As you learn a little you can do a little. As you learn a little more, you can do a little more. Things you'll learn include:
In the final section of this book, you'll see several practical examples of XML being used for real-world applications, including:
The XML Bible is divided into five parts:
Introducing XML
Document Type Definitions and Validity
Style Languages
Supplemental Technologies
XML Applications
By the time you're finished, you'll be ready to use XML to create compelling Web pages.
Part I begins with the history and theory behind XML and the goals XML is trying to achieve. It shows you how the different pieces of the XML equation fit together to create and deliver documents to readers. You'll see several compelling examples of XML applications to give you some idea of the wide applicability of XML, including Scalable Vector Graphics (SVG), the Resource Description Framework (RDF), the Mathematical Markup Language (MathML), the Extensible Forms Description Language (XFDL), and many others. Then you'll learn by example how to write XML documents with tags that you define that make sense for your document. You'll learn how to edit them in a text editor, attach style sheets to them, and load them into a Web browser such as Internet Explorer 5.0 or Mozilla. You'll even learn how you can write XML documents in languages other than English, even languages that are nothing like English, such as Chinese, Hebrew, and Russian.
Part II (Chapters 8 through 13) focuses on document type definitions (DTDs). A DTD specifies which elements are and are not allowed in an XML document, and the exact context and structure of those elements. A validating parser can read a document, compare it to its DTD, and report any mistakes it finds. DTDs enable document authors to ensure that their work meets any necessary criteria.
In Part II, you'll learn how to attach a DTD to a document, how to validate your documents against their DTDs, and how to write your own DTDs that solve your own problems. You'll learn the syntax for declaring elements, attributes, entities, and notations. You'll learn how to use entity declarations and entity references to build both a document and its DTD from multiple, independent pieces. This enables you to make long, hard-to-follow documents much simpler by separating them into related modules and components. You'll learn how to integrate other forms of data like raw text and GIF image files in your XML document. And you'll learn how to use namespaces to mix together different XML vocabularies in one document.
Part III, consisting of Chapters 14 through 18, teaches you everything you need to know about style sheets. XML markup specifies only what's in a document. Unlike HTML, it does not say anything about what that content should look like. Information about an XML document's appearance when printed, viewed in a Web browser, or otherwise displayed is stored in a style sheet. Different style sheets can be used for the same document. You might, for instance, want to use one style sheet that specifies small fonts for printing, another one with larger fonts for on-screen presentation, and a third with absolutely humongous fonts to project the document on a wall at a seminar. You can change the appearance of an XML document by choosing a different style sheet without touching the document itself.
Part III describes in detail the two style sheet languages in broadest use on the Web, Cascading Style Sheets (CSS) and the Extensible Stylesheet Language (XSL). CSS is a simple style-sheet language originally designed for use with HTML. It applies fixed style rules to the contents of particular elements. CSS exists in two versions: CSS Level 1 and CSS Level 2. CSS Level 1 provides basic information about fonts, color, positioning, and text properties and is reasonably well supported by current Web browsers for HTML and XML. CSS Level 2 is a more recent standard that adds support for aural style sheets, user interface styles, international and bidirectional text, and more.
XSL, by contrast, is a more complicated and more powerful style language that can apply styles to the contents of elements as well as rearrange elements, add boilerplate text, and transform documents in almost arbitrary ways. XSL is divided into two parts: a transformation language for converting XML trees to alternative trees, and a formatting language for specifying the appearance of the elements of an XML tree. Currently, many more tools support the transformation language than the formatting language.
Part IV consists of Chapters 19 through 21. It introduces some XML-based languages and syntaxes that layer on top of basic XML. XLinks provides multidirectional hypertext links that are far more powerful than the simple HTML <A>
tag. XPointers introduce a new syntax you can attach to the end of URLs to link not only to particular documents but also to particular parts of particular documents. RDF is an XML application used to embed metadata in XML and HTML documents. Metadata is information about a document, such as the author, date, and title of a work, rather than the work itself. All of these can be added to your own XML-based markup languages to extend their power and utility.
Part V, which consists of Chapters 22 to 28, shows you several practical uses of XML in different domains. XHTML is a reformulation of HTML 4.0 as valid XML. WML is an HTML-like language for serving Web content to cell phones, PDAs, pagers, and other memory, display, and bandwidth limited devices. Schemas are an XML-based syntax for describing the permissible content of XML documents that's considerably more powerful and extensible than DTDs. Scalable Vector Graphics (SVG) is a standard XML format for drawings recommended by the World Wide Web Consortium (W3C). The Vector Markup Language (VML) is a Microsoft-proprietary XML application for vector graphics used by Office 2000 and Internet Explorer 5.0. Microsoft's Channel Definition Format (CDF) is an XML-based markup language for defining channels that can push updated Web-site content to subscribers. Finally, a completely new application is developed for genealogical data to show you not just how to use XML tags, but why and when to choose them. Combining all of these different applications, you'll develop a good sense of how XML applications are designed, built, and used in the real world.
XML is a platform-independent technology. Furthermore, most of the best software for working with XML is written in Java and can run on multiple platforms. Much of this is included on the CD in the back of the book or is freely available on the Internet. To make the best use of this book and XML, you need:
A Web browser that supports XML such as Netscape 6.0, Mozilla, or Opera 5.0. Internet Explorer 5.0/5.5 also supports XML; but its built-in XML parser, MSXML, is quite buggy, so you'll need to upgrade it to MSXML 3.0 or later before you'll be able to use many of the techniques in this book.
A Java 1.2 or later virtual machine. (Java 1.1 can do in a pinch.) You'll just need it to run programs written in Java. You won't need to write any programs to use this book.
Glued to the inside back cover of the book you'll find a CD-ROM that holds all numbered code listings from this book as well as some longer examples that couldn't fit into this book. The CD-ROM also contains the complete text of various XML specifications in XML and HTML. (Some of the specifications are also available in other formats like PDF.) Finally, you will find an assortment of useful software for working with XML documents. Many (though not all) of these programs are written in Java, so they'll run on any system with a reasonably compatible Java 1.1 or later virtual machine (also included). Most of the programs that aren't written in Java are designed for Windows 95, 98, and NT/2000.
If I've succeeded in piquing your interest, you'll be able to find The XML Bible at almost any bookstore that carries computer books including amazon.com. It's $49.99, published by Hungry Minds, and written by me, Elliotte Rusty Harold.