> writing > books > XML Step by Step Second Edition > Introduction Excerpt

Extensible Markup Language, or XML, is currently the most promising language for storing and exchanging information on the World Wide Web.

Although Hypertext Markup Language (HTML) is presently the most common language used to create Web pages, HTML has a limited capacity for storing information. In contrast, because XML allows you to create your own elements, attributes, and document structure, you can use it to describe virtually any kind of information—from a simple recipe to a complex database. And an XML document—in conjunction with a style sheet or a conventional HTML page—can be easily displayed in a Web browser. Because an XML document so effectively organizes and labels the information it contains, the browser can find, extract, sort, filter, arrange, and manipulate that information in highly flexible ways.

XML thus provides an ideal solution for handling the rapidly expanding quantity and complexity of information that needs to be delivered on the Web.

Why Another XML Book?

XML can be confusing. XML applications are appearing at an astounding rate, and XML is intimately tied to an ever-increasing number of related standards and technologies used to format, display, process, and enhance XML documents. Many of these related standards and technologies are still in their infant stages, and are rapidly changing and evolving.

Most of the XML books that I have read attempt a comprehensive coverage of these technologies but get a bit lost in the maze. I believe that the typical XML book tries to survey too many XML technologies too superficially, without discriminating between the important and the unimportant, the practical and the impractical, the current and the future.

I wrote XML Step by Step to answer the most fundamental XML questions—what XML is, why it's needed, and how it can be used—and to teach the most important, practical XML technologies available now.

Although I was quite selective in choosing the topics to include in this book, I cover each of them in depth, and avoid partial solutions. (For example, because I tell you how to define XML attributes in Part 2, in Part 3 I show you how to access these attributes when you display the document.)

I never truly understood XML until I started actually writing and displaying XML documents. Consequently, I gave this book a hands-on approach, including many step-by-step instructions, practical examples, and tutorial exercises. I avoided theoretical and abstract discussions that can be so difficult to understand with a topic like XML.

The book and companion CD are also unique in providing a complete XML learning kit. This kit provides all the information, instruction, and software that you need to learn the practical basics of creating and displaying XML documents. The book also includes a comprehensive set of links to a wealth of XML information on the Web, which you can explore if you want to go beyond the basics.

What You'll Learn in This Book

Part 1 of this book (Chapters 1 and 2) provides a gentle introduction to XML and prepares you for the detailed information that comes later. Chapter 1 answers the basic questions I mentioned earlier—what XML is, why it's needed, and how it's being used to solve real-world problems. Chapter 2 provides a hands-on exercise that gives you a quick overview of the entire process of creating an XML document and displaying it in a Web browser.

Part 2 (Chapters 3 through 7) focuses on the rules and techniques for creating XML documents. Chapters 3 and 4 show you how to create well-formed XML documents—documents that conform to the basic syntactical rules of XML. Chapters 5, 6, and 7 tell you how to create valid XML documents—documents that not only conform to the basic syntactical rules but also match a specific document structure that you define either in the document itself or in a separate file. The chapters in Part 2 are based primarily on version 1.0 of the official XML specification developed by the World Wide Web Consortium (W3C).

Part 3 (Chapters 8 through 12) teaches you the most important of the current techniques for displaying XML documents in Web browsers. Chapters 8, 9 and 12 explain how to display an XML document by linking a style sheet that provides the browser with formatting and other display instructions. Chapters 8 and 9 cover cascading style sheets. A cascading style sheet (CSS) is a simple type of style sheet that allows you to precisely control the way the document content is formatted, but doesn't allow you to modify that content. Chapter 12 explains style sheets created with XSLT (Extensible Stylesheet Language Transformations). An XSLT style sheet is a more advanced type of style sheet that allows you not only to format the document content (using CSS properties) but also to select and modify the content, giving you complete control over the displayed output.

Chapters 10 and 11 teach you how to display an XML document by linking the document to a conventional HTML Web page that contains instructions for selecting and presenting the XML data. Chapter 10 explains how to do this using data binding, a straightforward technique that is suitable primarily for simple, symmetrically structured XML documents. Chapter 11 shows you how to display an XML document from an HTML page by writing a script that uses the XML Document Object Model (DOM), a much more flexible technique that allows you to display any type of XML document and any document component.

Note: Throughout this book, I use the term page to refer to HTML source and the term document to refer to XML source. I chose this convention to help clearly distinguish these two markup languages, which are often used in conjunction.

Part 3 focuses specifically on using the Microsoft Internet Explorer Web browser for displaying XML documents. (You'll see more details on Internet Explorer in the following section of the Introduction.)

Finally, the Appendix provides the addresses of Web sites containing an abundance of further information on most of the topics covered in this book. I also include all of these addresses in the chapters, each in the appropriate context. You'll find a copy of the Appendix on the companion CD in the Resource Links folder, under the filename Appendix.htm. ... You can visit any of these Web sites by opening Appendix.htm in your Web browser and simply clicking a link, rather than typing the address into the browser.

Tip: You might want to explore the following general XML information sites on the Web to supplement your reading of this book. The W3C offers a wide variety of information, standards, and services for Web authors at http://www.w3.org/, and it provides a diverse collection XML resources at http://www.w3.org/XML/. Also, the online reference work The XML Cover Pages includes comprehensive information on XML and other markup languages at http://www.oasis-open.org/cover/.

...

XML Step by Step, Internet Explorer, and MSXML

Although XML documents can be processed and displayed by many different types of software applications, the primary purpose of the language is to provide a universal format for storing, exchanging, and displaying information on the Web. Accordingly, this book teaches you how to display and work with XML documents using Web browsers, which are the most ubiquitous applications for accessing and displaying Web documents. Although most of the display techniques given in this book are based on public standards, and many of them will work with a variety of browsers, I wrote the book specifically for Microsoft Internet Explorer versions 5.0 through 6.0.

Internet Explorer uses the services of a separate software module to process and work with XML documents. This module is known as Microsoft XML Core Services, or just MSXML. (The product was formerly called the Microsoft XML Parser.) When you set up Internet Explorer on a computer, it automatically installs a particular version of MSXML. For instance, Internet Explorer 6.0 automatically installs MSXML version 3.0. If you wish, you can also install a later version of MSXML so that the more advanced XML services it provides are available to the browser (in addition to the features provided by the originally installed MSXML version). For example, if you want to be able to check the validity of XML documents using the latest implementation of XML schemas (described in Chapter 7), you need to install MSXML version 4.0, which is the first version of MSXML to support this type of schema. This book covers MSXML versions 2.0 through 4.0.

Because the companion CD provided with this book includes both Internet Explorer 6.0 and MSXML 4.0, you have everything you need to display the XML documents that you create using the techniques in the book.

...

Throughout this book, the unqualified expression Internet Explorer refers to Internet Explorer versions 5.0 through 6.0. Most of the techniques given in the book will work using any of these Internet Explorer versions, together with the version of MSXML that ships with the browser. If the book doesn't include a reference to a specific required version, you can assume that the technique described will work with any of these versions. A few techniques, however, require Internet Explorer 5.5 through 6.0 (namely, some of the CSS properties given in Chapters 8 and 9). A few other techniques require Internet Explorer 6.0 (namely, several of the CSS properties, plus the technique for using XSLT style sheets explained in Chapter 12). And one important technique requires that you install MSXML 4.0 (namely, using the XML schemas described in Chapter 7 to validate XML documents). Whenever a technique requires a specific version of Internet Explorer or MSXML, the book clearly states the version requirement.

Note: When the book states a version requirement, it refers to specific Internet Explorer or MSXML versions. For example, next to a feature it might state "Internet Explorer 6.0 only." Almost certainly, a later version will also work. However, I've taken the conservative approach of mentioning only the versions I've actually tested.

...

Requirements

The following are the basic hardware and software requirements for using XML Step by Step and its companion CD:

This book is meant to introduce you to XML, so you aren't required to have prior knowledge of XML itself. However, several of the techniques that the book teaches for displaying XML documents use one or more of the following Web-authoring languages: HTML, Dynamic HTML (DHTML), and Microsoft JScript (Microsoft's version of the generic JavaScript scripting language). Although the book explains the features of these languages used in the examples, some general knowledge of the languages would be helpful.

Tip: To read the official specification for the latest version of HTML 4, see the following Web site, provided by the W3C: http://www.w3.org/TR/html4/.

...

Valid HTML 4.01 Transitional