[ Cafe con Leche | Order from amazon.com | Table of Contents | Updated Chapters | Examples | Errata | Second Edition | French Translation/Traduction en Francais ]
XML Bible Cover

The XML Bible

Update: The second edition of the XML Bible has been published. I'm keeping this page here to support readers who bought the first edition, as well as for readers of translations, since most of the translations are still based on the first edition. (A few actually use a manuscript from in-between the first and second editions.)

However, if you want the most current information, you should go to the second edition page or the Gold edition page instead. Both are much improved over the first edition with huge amounts of new and updated material. They're completely up-to-date with the state of the art in XML as of 2001. If you're buying a new copy, you'll want to make sure you get the second edition or the Gold edition. The second edition has a robot on the cover instead of the three-dimensional "XML" you see to the left. The Gold Edition is in hardcover.

The XML Bible is a comprehensive introduction to using XML for Web page design. It shows you how to write XML documents, validate them with DTDs, design CSS and XSL style sheets for those documents, convert them to HTML, and publish them on Web servers for the world to read. You'll also learn how to use XML technologies like RDF, XLinks, XHTML, and namespaces to add structure and organization to your document collections. And finally, you'll learn about the many uses of XML beyond the Web site, including genealogy, subscription services, mathematics, vector graphics, and more. After reading this book I hope you'll agree with me that XML is the most exciting development on the Internet since Java, and that it makes Web site development easier, more productive, and more fun.

Who You Are

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.

What You Need to Know

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:

What You'll Learn

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. Thus the chapters in this book build steadily on each other. They are meant to be read in sequence. Along the way you'll learn:

In the final section of this book, you'll see several practical examples of XML being used for real-world applications including:

What's In The Book

The XML Bible is divided into five parts:

  1. Introducing XML

  2. Document Type Definitions and Validity

  3. Style Languages

  4. Supplemental Technologies

  5. XML Applications

By the time you're finished, you'll be ready to use XML to create compelling Web pages.

Part I: Introducing XML

Part 1, Introducing XML, elucidates the purpose, structure, and syntax of XML. It begins with the history and theory behind XML, the goals XML is trying to achieve, and 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 the Vector Markup Language (VML), 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 you define that make sense for your document. You'll see how to edit them in a text editor, attach style sheets to them, and load them into a Web browser like Internet Explorer 5.0 or Mozilla. You'll even learn how you can write XML documents in languages other than English, even languages that aren't written remotely like English such as Chinese, Hebrew, and Russian.

Part II: Document Type Definitions and Validity

An XML document may optionally contain a document type definition (DTD) that specifies which elements are and are not allowed in an XML document. The DTD specifies the exact context and structure of those elements that are allowed. A validating parser can read a document and compare it to its DTD, and report any mistakes it finds. This allows document authors to check 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 learnt the syntax for declaring elements, attributes, entities, and notations. You'll see how you can use entity declarations and entity references to build both a document and its DTD from multiple, independent pieces. This allows you to make long, hard-to-follow documents much simpler by separating them into related modules and components. And you'll learn how to integrate other forms of data like raw text and GIF image files in your XML document.

Part III: Style Languages

XML markup only specifies 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. Indeed, different style sheets can be used for the same document. You might for instance, want to use a style sheet that specifies small fonts for printing, another one that uses larger fonts for on screen use, and a third with absolutely humongous fonts for projecting 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 about the two style sheet languages in broadest use on the Web, Cascading Style Sheets (CSS) and the Extensible Style Language (XSL). CSS is a simple style sheet language originally designed for use with HTML. CSS exists in two versions. CSS Level 1 provides simple information about fonts; color, positioning, and text properties. CSS Level 1 is reasonably well supported by current Web browsers for HTML and XML. CSS Level 2 is a more recent standard that builds on CSS Level 1 by adding support for tables, aural style sheets, international and bi-directional text, user interface styles, and much more. CSS level 2 is only beginning to be supported by current browsers.

CSS is a relatively simple standard that applies fixed style rules to the contents of particular elements. XSL, by contrast, is a more complicated and more powerful style language that can not only apply styles to the contents of elements but also 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 the transformation language is much better supported by most tools than the formatting language. XSL is still under active development and is not yet a standard. Nonetheless, it is beginning to firm up, and is supported by Microsoft Internet Explorer 5.0 and some third party formatting engines.

Part IV: Supplemental Technologies

Part IV introduces some XML based languages and syntaxes that layer on top of basic XML. XLinks provide multi-directional 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 to particular parts of particular documents. Namespaces use prefixes and URLs to disambiguate conflicting XML markup languages. The Resource Description Framework (RDF) is an XML application used to embed meta-data in XML and HTML documents. Meta-data 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: XML applications

Part V shows you four practical uses of XML in different domains. XHTML is a reformulation of HTML 4.0 as valid XML. Microsoft’s Channel Definition Format (CDF), is an XML-based markup language for defining channels that can push updated Web site content to subscribers. The Vector Markup Language, (VML) is an XML application for scalable graphics used by Microsoft Office 2000 and Internet Explorer 5.0. 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.


The appendixes focus on the formal specifications for XML, as opposed to the more informal description of it used throughout the rest of the book. Here you'll find both the official XML 1.0 specification published by the W3C as well as detailed explanations of the individual parts of that specification including the BNF grammar, well-formedness constraints, and validity constraints.


Glued to the inside back cover of this book you'll find a CD-ROM that holds all numbered code listings you'll find in the text. It also includes many longer examples that couldn't fit into this already overly large tome. Finally, you'll 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. Most of the programs that aren't written in Java are designed for Windows 95, 98, and NT. Most files on the companion CD-ROM are not compressed, so you can access them directly from the CD.

What You Need

To make the best use of this book and XML, you need:

Any system that can run Windows will suffice. This book mostly assumes you're using Windows 95 or NT 4.0 or later. As a longtime Mac and Unix user, I do regret this. Like Java, XML is supposed to be platform independent. Also like Java, the reality is somewhat short of the hype. Although XML code is pure text that can be written with any editor, there are many tools that are currently available only on Windows.

However, although there aren't many (or even any) Unix or Macintosh native XML programs, there are an increasing number of XML programs written in Java. If you have a Java 1.1 or later virtual machine on your platform of choice, you should be able to make do. Even if you won't be able to load your XML documents directly into a Web browser, you can still convert them to XML documents and view those. Currently Mozilla is still pre-alpha. However, when it's released, it should provide the best XML browser yet across multiple platforms.

Summing Up

XML is the wave of the future. Writing The XML Bible not only taught me about XML itself. It changed the way I looked at the Web. XML is a sea change in the way you looked at web sites and web site development. And I can think of no better way to learn about it than reading The XML Bible. Why don't you check it out, and let me know what you think?

If I've succeeded in piqueing 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 IDG Books, and written by me, Elliotte Rusty Harold.

Table of Contents

Part I: Introducing XML
Chapter 1: An Eagle's Eye View of XML (no examples in this chapter)
Chapter 2: XML Applications
Chapter 3: Your First XML Document
Chapter 4: Structuring Documents
Chapter 5: Attributes, Empty Tags, and XSL
Chapter 6: Well-Formed XML Documents
Chapter 7: Foreign Languages and Non-Roman Text
Part II: Document Type Definitions and Validity
Chapter 8: Element Declarations
Chapter 9: Entities and External DTD Subsets
Chapter 10: Attribute Declarations in DTDs
Chapter 11: Embedding Non-XML Data
Part III: Style Sheets
Chapter 12: Cascading Style Sheets Level 1
Chapter 13: Cascading Style Sheets Level 2
Chapter 14: XSL Transformations
Chapter 15: XSL Formatting Objects
Part IV: Supplemental Technologies
Chapter 16: XLinks
Chapter 17: XPointers
Chapter 18: Namespaces
Chapter 19: The Resource Description Framework
Part V: XML Applications
Chapter 20: Reading Document Type Definitions
Chapter 21: Pushing Web Sites with CDF
Chapter 22: The Vector Markup Language
Chapter 23: Designing a new XML Application
XML QuickRef
Appendix A: XML Reference Material
Appendix B: XML 1.0 Specification
Appendix C: About the CD-ROM

[ Cafe con Leche | Order from amazon.com | Table of Contents | Updated Chapters | Examples | Errata | Second Edition ]

Copyright 1999, 2001 Elliotte Rusty Harold
Last Modified November 12, 2001