The XML 1.1 Bible

When the first edition of the XML Bible was published about five years ago, XML was a promising technology with a small but growing niche. In the last half decade, 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 1.1 Bible is your introduction to the exciting and still-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 mathematics to vector graphics to genealogy. And you'll learn how to take advantage of XML for your own unique projects, programs, and web sites.

What's New in the 1.1 Edition

The obvious new feature is that the book now covers the recently released version 1.1 of XML. XML 1.1 has a number of new features
that make it much more suitable for use by IBM mainframe programmers
and people whose native language is Amharic, Burmese, or Cambodian. That doesn't describe you? Then to be honest there really isn't much in XML 1.1
to interest you, which is why the XML 1.1 Bible is quite clear in its recommendation that most users should stick to XML 1.0 for the foreseeable future.

However, although the new edition is titled the
XML 1.1 Bible, I didn't stop with the relatively minor changes needed to make it 1.1 savvy. A number of other sections were updated as well including the chapters on XPointers, Schemas, CSS, and XHTML. However, most importantly,
the book was substantially reduced in size and price.
The last edition topped out at 1600 pages and cost almost $70.
This edition cuts both the size and the price by almost half. The XML 1.1 Bible should strain neither your back nor your wallet. It comes in at a little over 1000 pages, and just under $40 (on top of which Amazon and other booksellers are currently offering it for 30% off.)

How did I manage such a radical reduction in size? As the French philosopher and mathematician Blaise Pascal once wrote, "I have only made this longer because I have not had the time to make it shorter." I know how he felt. The first edition of the XML Bible was written under great time pressure, was finished well after deadline, and was the largest book I had written up to that point. My favorite reader comment about that 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." While I probably could write 10,000 words about blue, for this edition, I restrained myself and took the time to write more concisely. I rewrote the book from the ground up; and while I retained the basic flavor and outline that proved so popular with the last three editions, I tightened up the writing and cut many examples down to size. With the benefit of five years of hindsight, I have also been able to expand coverage of promising new technologies (schemas, XInclude, XHTML, SVG, XML Base, and RDDL) while eliminating coverage of applications that proved to be less useful than they initially appeared (WML, VML, CDF, HTML+TIME, RDF, aural style sheets, and so on). The result is a more concise, approachable volume that covers more of what you need to know and less of what you don’t. If you liked the first or second edition, you’re going to like the third edition even more. I’m confident you’ll find this an even more useful tutorial and reference.

One change deserves special note. The baseball examples are history.
They've been replaced throughout by a shorter, more approachable
XML application involving television listings that I hope is a little less offputting to European audiences and other non-baseball fans. The baseball examples were a real dividing line among readers. You either loved them or hated them. I'm hopeful that the new television examples in this edition will be somewhat less controversial. If nothing else, they are certainly shorter.

Who You Are

Unlike most other XML books on the market, The XML 1.1 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:

You should be able to write a basic HTML page including links, images, and text using a text editor.

You should be able to place that page on a Web server.

On the other hand, there are a number of things I do not assume you know. In particular:

No knowledge of SGML is required or expected. XML is supposed to be simpler and more widespread than SGML. It can't be that if you have to learn SGML first.

Unlike many other books on XML, this one does not assume you area programmer, whether of Java, Perl, C, or some other language. XML is a markup language, not a programming language. You don't need to be a programmer to write XML documents.

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. Things you'll learn include:

How to author XML documents and deliver them to readers.

How semantic tagging makes XML documents easier to maintain and develop than their HTML equivalents.

How to post XML documents on Web servers in a form everyone can read.

How to make sure your XML is well formed.

How to validate documents against DTDs and schemas.

How to use entities to build large documents from smaller parts using entities and XInclude.

How to describe data with attributes.

How to embed non-XML data in your documents.

How to merge different XML vocabularies with namespaces.

How to format your documents with CSS and XSL style sheets.

How to connect documents with XLinks and XPointers.

How to write metadata for Web pages using RDF.

In the final section of this book, you'll see several practical examples of XML being used for real-world applications, including web site design, vector graphics, and genealogy.

What's In The Book

The XML 1.1 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: Introducing XML

Part I (Chapters 1 through 6) 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 enable you 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 Open Financial Exchange (OFX), 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.

Part II: Document Type Definitions

Part II (Chapters 7 through 11) 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 new 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 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 use namespaces to mix together different XML vocabularies in one document.

Part III: Style Languages

Part III (Chapters 12 through 16) 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 example, 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 today, 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.

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.

Part IV: Supplemental Technologies

Part IV (Chapters 17 through 20) introduces some XML-based languages and syntaxes that layer on top of basic XML to provide additional functionality and features. XLinks provide 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. XInclude enables you to build large XML documents out of multiple smaller XML documents. XML Schemas provide a more complete validations language that includes data typing and range checking. 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 (Chapters 21 to 25) demonstrates several practical uses of XML in different domains. XHTML is a reformulation of HTML 4.0 as valid XML. RDDL is an XHTML- and XLink-based language for documents containing meta-information placed at the end of namespace URLs. Scalable Vector Graphics (SVG) is a standard XML format for drawings recommended by the World Wide Web Consortium (W3C). Finally, a completely new application is developed for genealogical data to show you not just how to use XML tags and technologies, 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.

What You Need

XML is a platform-independent technology. You’'ll notice that screen shots in this book have been captured from Windows, Mac OS 9, Mac OS X, and Linux. Almost all the examples work equally well across all common platforms. You will need a web browser that supports XML, such as Mozilla, Netscape 6.0 or later, or Internet Explorer 6.0.

Furthermore, most of the best software for working with XML is written in Java and can run on multiple platforms. Much of this is freely available on the Internet. You will need a Java 1.2 or later virtual machine. (Java 1.1 can do in a pinch.) You won’'t need to write any programs to use this book. You’'ll just need it to run programs written in Java.

Summing Up

XML is the wave of the future. Writing The XML 1.1 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 1.1 Bible.
Why don't you
check it out, and let me know what you think?

If I've succeeded in piquing your interest, you'll be able to
find The XML 1.1 Bible
at almost any bookstore that
carries computer books including amazon.com.
It's $39.99, published by John Wiley & Sons, and written by me, Elliotte
Rusty Harold. The ISBN number is 0-7645-4986-3.