| Document | elements | code | HTML | Attributes | examples | Object | Languages | type |
  • Sitemap
  • Contact
  • About This Electronic Book
  • Chapter 1 -- Understanding Markup Languages
  • A Brief History of Markup Languages
  • How Markup Works
  • Specific and Generalized Markup Languages
  • The Big Markup Picture
  • Chapter 2 -- Enter XML
  • What Is XML?
  • Where Does XML Fit In?
  • The Goals of XML
  • XML, Recommendations, and Standards
  • Chapter 3 -- XML Structure and Syntax
  • XML Structure
  • XML Syntax
  • Valid Versus Well-Formed XML
  • Chapter 4 -- Playing by the Rules -- The DTD
  • Document Classes
  • The Document Type Definition
  • Introduction

    HTML (Hypertext Markup Language) has been called the foundation of the World Wide Web. It provides a standardized way to create pages of formatted information that can be delivered to an ever-increasing global audience by means of the Internet. In a very real way, HTML—combined with HTTP (Hypertext Transport Protocol)—has revolutionized how people send and receive information. But HTML was designed primarily for data display. As a result, HTML focuses almost entirely on how information looks, not on what the information is or how it is structured. This is where Extensible Markup Language (XML) comes in.

    XML is an open, text-based markup language that provides structural and semantic information to data. This "data about data," or metadata, provides additional meaning and context to the application using the data and allows for a new level of management and manipulation of Web-based information. XML, a subset of the popular Standard Generalized Markup Language (SGML), has been optimized for the Web. This helps make XML a powerful, standards-based complement to HTML that could be as important to the future of information delivery on the Web as HTML was to its beginning.

    XML is intended to be used by content creators as well as by programmers. Since XML is text-based, it can be read and worked with easily in relatively nontechnical situations, but its ability to organize, describe, and structure data also makes it ideal for use in highly technical applications. XML thus provides common ground for creating structured data and making it available for manipulation and display.

    Although XML is often called a language, it is, strictly speaking, a metalanguage. This means that XML can be used to create other languages. Thereby, vocabularies, which are language applications of XML, can be created to address targeted needs or solve specific problems. Some examples of XML vocabularies include:

    • XSL A style sheet_based formatting language that can take XML data and produce a wide range of output results.
    • XLL An extended linking specification that takes the hyperlinking mechanism of HTML to new levels.
    • SMIL A standardized multimedia authoring language that allows sophisticated multimedia authoring on the Web.
    • XSL Patterns An XML query language that provides advanced searching capabilities on XML data.

    About This Book

    As a dedicated observer of XML development and a participant in its implementation almost since its creation, I have been amazed to witness the degree to which the software industry has come to support this technology. It has become rare to pick up a computer magazine or look at an industry Web site without seeing something about XML. As you might imagine, I believe in the need for and benefits of XML, and I want it to succeed. The developers of XML and its many applications and vocabularies realize that for XML to be used and adopted widely, it not only must be easy to understand, it must be supported by resources that help make it easy to use. In my own work with XML, I have seen the need for practical XML resources. My hope is that this book contributes to the pool of effective tools that help developers and authors work successfully with XML.

    The Focus of This Book

    There are several implementations of XML, and there are many XML processors. This book focuses on the implementation of XML in Microsoft Internet Explorer 5 and on the Microsoft XML processor, called Msxml. I point this out because there are special features regarding the use of XML in Internet Explorer 5 that are distinct from the functionality of the Msxml processor. These special Internet Explorer features are addressed in Chapter 11, and I do not focus on them throughout most of the book. Rather, I attempt to deal directly with the XML language itself and the Msxml processor. This should afford you, the XML author, the most flexibility in the event that Microsoft decides to make the processor available outside of the browser. While all the examples in this book and on the companion CD will work in Internet Explorer 5, they will also work in earlier versions of Internet Explorer or in other applications (such as Microsoft Visual Basic or C++ applications) that use the current version of Msxml. (Note that at the time of this writing, Microsoft does not support the use of Msxml outside of Internet Explorer 5, but it's possible that policy will be reevaluated in the future.) The only exception to my focus on the Msxml processor is Chapter 7, "Linking with XML." XLink and XPointer—two vocabularies focused on linking with XML—are not currently supported by Msxml in Internet Explorer 5. Nevertheless, I included a chapter on this topic because it is an important part of XML and will eventually be part of many XML solutions.

    What You Should Know

    This book is targeted at intermediate computer users. It is expected that readers will have a working knowledge of the World Wide Web and some level of familiarity with HTML. Knowledge of markup languages such as SGML is helpful but not necessary. While programming experience also is not necessary, scripting is used throughout the book, and so some familiarity with programming concepts would be helpful. This book most likely will benefit:

    • Web developers who want to get started with XML and incorporate it into their Web development work
    • Technology executives or other professionals who want to gain an understanding of the XML language and how it might be applied to their businesses
    • Programmers who want information on how to begin incorporating XML into their code
    • Content developers who want to learn to use XML to create and manage structured data
    • Computer hobbyists who want to understand XML and how it works

    Conventions

    Code samples appear in monospaced courier font as shown here:

    <?xml version="1.0"?>
    <MEMO>
      <TO>Jodie</TO>
      <FROM>Bill</FROM>
      <CC>Philip</CC>
      <SUBJECT>My first XML document</SUBJECT>
      <BODY>Hello, World!</BODY>
    </MEMO>

    Code samples that are included on the companion CD appear in the book with a shaded background. (Most code samples are contained on the companion CD, as noted in each chapter.) JScript, Microsoft's implementation of JavaScript, is used for all code samples in the book.

    Case Sensitivity

    Markup tags appear in uppercase letters—for example, <TITLE></TITLE>—in code and in text. Object properties, attributes, methods, and events are case sensitive and appear with the proper case applied. One such case is the XML declaration. It should always appear in lower case, as shown here: <?xml version="1.0"?>. While the XML specification does not specify case in most instances, it is important that consistency be maintained when coding. For example, if you define an element name with a certain case, you should use that case when referencing that element. While this is not always required, it is the safest way to go. Another thing to keep in mind is that vocabularies defined in XML are often case sensitive. These are noted throughout the book, but a general rule is to use the vocabulary as it is defined in its specification.

    Web Links

    Most chapters contain relevant Web addresses where appropriate. While these were accurate and active at the time this book was written, please remember that URLs change and might no longer be active in some cases.

    Appendix C contains a list of relevant topics available on the Microsoft Site Builder Network (SBN) and the Microsoft Developer Network (MSDN). These topics can be accessed on the companion CD or on the Internet. To access a topic on the CD, open the file Workshop XML Reference.shtml to reach the SBN XML Table of Contents (XML TOC), and then navigate as described to the link for that particular topic. These topics are also available on the Internet. To get to the online versions of these topics, visit the MSDN Online Resource page at http://msdn.microsoft.com/resources/pardixml.shtml (or open the file named MSDN_OL.shtml on the companion CD). This page will direct you to the appropriate location on the MSDN Web site. (You can also access the SBN home page on the CD by opening the file SBNSetup.exe.)

    Using the Msxml Parser from the Command Line

    From the Tools\Command Line XML folder on the companion CD, copy Msxml.exe to your computer and launch from a DOS command prompt, pointing to an XML file to parse. This tool tells you whether the specified XML code is valid and can also be used to convert the XML to a different encoding. See the Command Line XML_readme.shtml file for information on how to use this tool.

    What's on the Companion CD

    The companion CD contains:

    • All the code samples in the book, organized by chapter name in subfolders of the Samples folder (You can install these samples by double-clicking Setup.exe.)
    • An electronic version of the book in HTML format, in the Ebook folder
    • A snapshot of the SBN Workshop Web site
    • Tools to help you create and test XML files, in the Tools folder
    • A copy of the XML 1.0 specification in HTML format, in the XML1Spec folder XML IN ACTION
    Document   elements   code   HTML   Attributes   examples   Object   Languages   type   used   Linking   processors   Patterns   Namespaces   Chapter   other   Markup   declaration   Page   Structure   Figure   nodeList   text   Model   work