Extensible Markup Language, or XML, is currently the most promising language for storing and delivering 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, XML has a highly flexible syntax that allows you to use it to describe virtually any kind of information, from a simple recipe to a complex database (hence the term extensible). 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 structures and labels the information it contains, the browser can find, extract, sort, filter, arrange, and manipulate that information in very flexible ways.
XML thus provides an ideal solution for handling the rapidly expanding quantity and complexity of information that needs to be put 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 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 II, in Part III 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 I 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 II (Chapters 3 through 6) 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 most basic XML requirements. Chapters 5 and 6 tell you how to create valid XML documents—documents that conform to an optional and more exacting set of rules. The chapters in Part II are based on the official XML specification developed by the World Wide Web Consortium (W3C).
Part III (Chapters 7 through 10) teaches you the most important of the current techniques for displaying XML documents in Web browsers. Chapters 7 and 10 explain how to display an XML document by attaching a style sheet that provides the browser with formatting instructions. Chapter 7 covers cascading style sheets—the simplest but most limited type of style sheet—while Chapter 10 explains style sheets created with XSL (Extensible Stylesheet Language), a more advanced and flexible type of style sheet written in XML.
Chapters 8 and 9 teach you how to display an XML document by linking the document to a conventional HTML Web page that contains instructions for accessing, processing, and presenting the XML data. Chapter 8 explains how to do this using data binding, a simple technique suitable for only certain XML documents. Chapter 9 shows you how to display an XML document from an HTML page by writing scripts that use a highly flexible programming object known as the XML Document Object Model (DOM), which you can use for any type of XML document.
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 clearly distinguish these two markup languages, which are often used in conjunction.
Part III focuses specifically on using the Internet Explorer 5 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 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. (For information on installing Appendix.htm on your computer, see the Readme file on the CD.) 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/. Also, the XML Cover Pages includes comprehensive information on XML and other markup languages at http://www.oasis-open.org/cover/.
XML Step by Step and Internet Explorer
Although most of the techniques given in this book are based on public standards and will work with a variety of browsers, I wrote the book specifically for Microsoft Internet Explorer versions 5.0 through 5.5. And the companion CD provided with this book (described later in the Introduction) includes Internet Explorer version 5.01. You can therefore use the browser software provided on the CD to display any XML document that you create with the techniques in the book.
Tip: You can download the latest version of Internet Explorer 5.5 at http://www.microsoft.com/windows/ie. If you can't locate Internet Explorer 5.5 on this page, enter the phrase "Internet Explorer 5.5" into the Search box and click the Search button.
Throughout the book, the expression Internet Explorer 5 refers to the Microsoft Internet Explorer browser versions 5.0 through 5.5. When the information applies only to a particular Internet Explorer version, the book refers to that version by including the decimal and the additional digit(s), such as Internet Explorer 5.01 or Internet Explorer 5.5.
All the features and techniques presented in the book will work on Internet Explorer 5.5. A few features appeared for the first time in version 5.5 and therefore won't work with earlier versions. I've clearly marked these features as available only with Internet Explorer 5.5.
Requirements
The following basic hardware and software requirements are necessary for using XML Step by Step and its companion CD:
- To access the companion CD and to install the Internet Explorer software included on the CD, you need a computer that runs Microsoft Windows and has a CD drive. You can use Windows 95, Windows NT 4.0 (with Service Pack 3), or any later version of Windows.
- Selecting the "Install Example Files and Resource Links" setup option will require less than one megabyte (1 MB) of hard disk space.
- To view the Web sites referenced in the book, you need a connection to the Internet. However, viewing these sites isn't required for successfully using the book; therefore, an Internet connection is optional.
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 related 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 these languages is still useful.



