[This local archive copy mirrored from the canonical site: http://sunsite.unc.edu/xml/books/xml/; links may not have complete integrity, so use the canonical document at this URL if possible.]
Welcome to XML. 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.
This book is your introduction to the exciting and fast growing world of XML. In this book you'll learn how to write documents in XML and how to use XSL style sheets to convert those documents into HTML so legacy browsers can read them. You'll also learn how to use DTDs to describe and validate documents. This will become increasingly important as more and more browsers like Netscape and Internet Explorer 5.0 provide native support for XML.
This book is the first to look at 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 powerful web sites.
This book is aimed squarely at web site developers. I assume that 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 XSL 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 beyond the most basic cut and paste JavaScript.
However, 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 of Netscape 1.0. 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:
There are also a number of things that are not prerequisites for this book but that would nonetheless be helpful to know once you begin writing XML files. Among others these include
You don't need to know any of these things to learn to write XML files, any more than you need to know them to write HTML. (You absolutely do not have to know how to read Chinese to read this book. It is written in English, after all.) Nonetheless readers who do understand these topics will find a few sections of this book more compelling than readers who do not. If you are familiar one or more of these topics, then certain practices can be more easily motivated and explained. If you don't know about these things, you can still write XML; you'll just be asked to accept that there is indeed a method to the madness behind certain rules of XML that appear arbitrary on the surface.
One final note: this book 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 some crucial tools that are currently available only on Windows. I very much hope that in the not too distant future these tools will be made available on the Macintosh and Unix. But until that becomes true, XML development will remain primarily a PC based activity.
In the final section of this book, you'll see several practical examples of XML being used for real-world applications including:
This book is divided into four parts:
By the time you're finished, you'll be ready to use XML to create compelling web pages.
Part 1, XML Basics. introduces the purpose, structure, and syntax of XML and its associated style sheet language, XSL. In Part 1 you'll learn how to create basic XML pages and publish them on the Web.
The first chapter introduces you to the history and theory behind XML, the goals XML is trying to achieve, and to some of XML's more intriguing uses and applications. You'll learn what XML is good for, and what it isn't. You'll learn how XML can be used for such diverse areas as chemistry, mathematics, push, multimedia arrangements, and more. Finally, some intriguing current uses of XML are briefly explored including the Chemical Markup Language, Microsoft's Channel Definition Format, and the complete works of William Shakespeare.
Actually, XML predefines almost no tags at all. Instead, XML enables you to define your own tags as needed. These tags and the documents built from them are not completely arbitrary, however. They have to follow a specific set of rules elaborated in this chapter. A document that follows these rules is well-formed. Well-formedness is the minimum criteria necessary for XML parsers, processors, and browsers to read your files. In this chapter, you'll examine the rules for well-formed documents and focus on how XML differs from HTML.
Each XML document can be associated with an XSL style sheet that describes how individual elements should be formatted. XSL style sheets provide far more detailed control over appearance than is possible with standard or non-standard HTML. This chapter shows how to use style sheets to provide custom appearances that provide a web site with a unified look and feel.
In this chapter you'll explore how to write XML documents in languages other than English, how international text is represented in computer applications, how XML understands text, and how you can take advantage of the software you have to read and write in languages other than English.
XML provides all the hypertext power of HTML while adding the ability to link to essentially arbitrary locations in a remote file without using named anchors. Thus it's possible to link to a particular paragraph of text on a foreign web server whether or not the author of that remote page made special provision for that paragraph to be linked to. This chapter shows how linking works in XML, and discusses when and when not to use it.
Chapter 9 introduces XLL, the eXtensible Linking Language, a new means of linking between documents. XLinks and XPointers can do everything HTML's URL based hyperlinks and anchors can do and a lot more. XLinks enable multidirectional links. XPointers allow links arbitrary locations in a document. These features make XLL not more suitable for new uses, but also for things that can only be done with considerable effort in HTML such as cross-references, footnotes, end notes, interlinked data, and more.
A CDF file is an XML document, separate from, but linked to the HTML documents in a site. The channel defined in the CDF document establishes the parameters for a connection between the readers and the content on the site. The data can be transferred through push--sending notifications, or even whole web sites, to registered readers--or through pull, where readers choose to load the page in their web browser and get the update information.
There is no need to rewrite your site to take advantage of CDF. The CDF file is simply an addition to the site. A link to a CDF file, generally found on a site's home page, downloads a copy of the channel index to the reader's machine. This allows the reader to access the current data, as defined in the channel, with a click on an icon.
I also hope you'll stop along the way to try out some of the examples and to write some XML documents of your own. It's important to learn not just by reading, but also by doing.
If I've succeeded in piqueing your interest, you'll be able to find XML: Extensible Markup Language in late June, 1998, at almost any bookstore that carries computer books including amazon.com. It's $39.99, published by IDG Books, and written by me, Elliotte Rusty Harold.