|
XML Step by Step Second Edition
By Michael J. Young Published by Microsoft Press Pages: 488 plus a companion CD ISBN: 0735614652 |
The first edition of XML Step by Step won the top award, "Distinguished Technical Communication," in the 2000-2001 International Technical Publications Competition of the Society for Technical Communication (STC).
A book and CD providing a complete XML learning kit!
XML (Extensible Markup Language) is currently the most promising language for storing and delivering information on the Web. 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 business database. And because an XML document so effectively organizes and labels the information it contains, you can easily sort, filter, search, and manipulate that information in highly flexible ways. XML Step by Step Second Edition clearly explains the basics of XML, and shows both nonprogrammers and Web developers how to create effective XML documents and how to display them on the Web. The book takes a hands-on learning approach, and focuses on the most practical techniques that you can use now, even if you don't have extensive technical knowledge.
Topics on this page:
What's New in the Second Edition of XML Step by Step
The following are some of the important updates to the book:
- To reflect the explosive growth of XML applications, I added 16 more XML applications to the list in Chapter 1. (Even with these additions, the list still represents only a small sampling of the current uses for XML.)
- I wrote a new chapter (Chapter 7) covering XML schemas as defined by the World Wide Web Consortium (W3C) XML Schema specification, which achieved the status of recommendation in May 2001. An XML schema is used to define the content and structure of a class of XML documents. I also added several sections to Chapter 11 to explain how to check the validity of an XML document using an XML schema.
- I completely revamped the final chapter in the book, which formerly covered XSL style sheets (based on the W3C's December 1998 Extensible Stylesheet Language (XSL) Version 1.0 working draft), to cover the newer XSLT style sheets (based on the W3C's November 1999 XSL Transformations (XSLT) Version 1.0 recommendation). I also covered many more style sheet features than before.
- I updated the book to cover the XML features of Internet Explorer versions 5.0 through 6.0, as well as MSXML 2.0 through 4.0. (MSXML is the software module that provides basic XML services for Internet Explorer. The first edition covered Internet Explorer versions 5.0 through 5.5, and MSXML 2.0 through 2.5.) Also, I recaptured each of the figures that shows a Windows element, such as a message box or the Internet Explorer window, using the Windows XP Professional operating system.
The second edition is about 100 pages longer than the first. The following are some of the important new or expanded topics you'll find in these additional pages:
- I added coverage to Chapter 3 on the often-confusing topic of how white space (sequences of space, tab, or line break characters) is handled in XML documents.
- I greatly expanded the coverage on the increasingly important topic of namespaces. Namespaces are used to qualify names in XML documents so that naming conflicts can be avoided. Chapter 3 now includes a general discussion on namespaces (in the section "Using Namespaces"), and later chapters (Chapters 5, 8, 10, 11, and 12) now include information on using namespaces with specific XML technologies.
- I added a sidebar to Chapter 3 covering the new all-inclusive URI Internet addressing scheme ("URIs, URLs, and URNs").
- In response to the many messages I received from readers working with non-English languages in XML, I added a lengthy sidebar to Chapter 3 covering XML language encoding ("Characters, Encoding, and Languages").
- Because of the importance of cascading style sheet (CSS) properties for formatting XML, regardless of the method used to display the document, I covered quite a few additional properties and property settings. These include properties and settings first supported by Internet Explorer version 6.0, such as the list-item setting of the display property for creating a bulleted or numbered list. I also added coverage on some of the more advanced properties defined in the CSS Level 2 specification, such as the position property for placing an element's content at a specific position on the page, outside of the normal flow of text.
- In Chapter 11 I now explain an alternative method for loading an XML document into an HTML page using a script. (The first edition covered only the data island method for loading an XML document. A data island is an XML document or a reference to an XML document embedded within an element in an HTML page.)
Contents
Introduction
Why Another XML Book?
What You'll Learn in This Book
XML Step by Step, Internet Explorer, and MSXML
Using the Companion CD Requirements
How to Contact the Author
Microsoft Press Support Information
Part 1: Getting Started
Chapter 1: Why XML?
The Need for XML
The Official Goals of XML
Standard XML Applications
Real-World Uses for XML
XML Applications for Enhancing XML Documents
Chapter 2: Creating and Displaying Your First XML Document
Creating an XML Document
Displaying the XML Document
Part 2: Creating XML Documents
Chapter 3: Creating Well-Formed XML Documents
The Parts of a Well-Formed XML Document
Adding Elements to the Document
Adding Attributes to Elements
Using Namespaces
Chapter 4: Adding Comments, Processing Instructions, and CDATA Sections
Inserting Comments
Using Processing Instructions
Including CDATA Sections
Chapter 5: Creating Valid XML Documents Using Document Type Definitions
The Basic Criteria for a Valid XML Document
The Advantages of Making an XML Document Valid
Adding the Document Type Declaration
Declaring Element Types
Declaring Attributes
Using Namespaces in Valid Documents
Using an External DTD Subset
Converting a Well-Formed Document to a Valid Document
Chapter 6: Defining and Using Entities
Entity Definitions and Classifications
Declaring General Entities
Declaring Parameter Entities
Inserting Entity References
Inserting Character References
Using Predefined Entities
Adding Entities to a Document
Chapter 7: Creating Valid XML Documents Using XML Schemas
XML Schema Basics
Declaring Elements
Declaring Attributes
Creating an XML Schema and an Instance Document
Part 3: Displaying XML Documents on the Web
Chapter 8: Displaying XML Documents Using Basic Cascading Style Sheets
The Basic Steps for Using a Cascading Style Sheet
Cascading in Cascading Style Sheets
Setting the display Property
Setting Font Properties
Setting the color Property
Setting Background Properties
Setting Text Spacing and Alignment Properties
Chapter 9: Displaying XML Documents Using Advanced Cascading Style Sheets
Setting Box Properties
Using Pseudo-Elements (Internet Explorer 5.5 through 6.0 Only)
Inserting HTML Elements into XML Documents
Creating and Using a Full-Featured Cascading Style Sheet
Chapter 10: Displaying XML Documents Using Data Binding
The Main Steps
The First Step: Linking the XML Document to the HTML Page
The Second Step: Binding HTML Elements to XML Elements
Using Scripts with the DSO
Chapter 11: Displaying XML Documents Using Document Object Model Scripts
Linking the XML Document to the HTML Page
The Structure of the DOM
Accessing and Displaying XML Document Elements
Accessing and Displaying XML Document Attribute Values
Accessing XML Entities and Notations
Traversing an Entire XML Document
Checking An XML Document for Validity
Chapter 12: Displaying XML Documents Using XSLT Style Sheets
Using an XSLT Style Sheet—the Basics
Using a Single XSLT Template
Using Multiple Templates
Using Other Select and Match Expressions
Filtering and Sorting XML Data
Accessing XML Attributes
Referencing Namespaces in XSLT
Using Conditional Structures
Appendix: Web Addresses for Further Information
General Information on XML
Internet Explorer and MSXML
XML Applications
Namespaces
URIs and URNs
XML Schemas
Cascading Style Sheets (CSS)
Data Binding and the Data Source Object (DSO)
ActiveX Data Objects (ADO) and the ADO recordset Object
HTML and Dynamic HTML (DHTML)
Microsoft JScript
The Document Object Model (DOM)
Extensible Stylesheet Language Transformations (XSLT) and XPath
Author's Web Site
Companion CD
- Copies of the source files given in the numbered listings in the book.
- All the graphics files displayed by the example source files.
- A copy of the Appendix in the Web page file Appendix.htm.
- Internet Explorer version 6.0. You can use Internet Explorer 6.0 to display any of the XML documents and HTML pages provided on the companion CD. When you install Internet Explorer 6.0, it automatically installs MSXML version 3.0.
- MSXML 4.0. You'll need to install MSXML 4.0 in order to use the XML schemas presented in Chapter 7.
- Microsoft XML SDK 4.0. This software development kit (SDK) provides several tools for working with XML and MSXML 4.0. Most importantly, it includes a help file (xmlsdk.chm) with comprehensive information on the XML technologies implemented by MSXML 4.0.
Download CD Files!
If you purchased XML Step by Step Second Edition without a companion CD, you can obtain all of the example source files that are included on the CD by downloading the ZIP file XMLSBSe2.zip.
Errors
Note that some or all of these errors might have been corrected in more recent printings of the book.
page references throughout book
The desktop publishers inserted the wrong page numbers for many of the page references in the book. For a list of corrections, click here.
Table of Contents and headings throughout book
The desktop publishers incorrectly changed some of the lower-level headings to top-level headings. The following headings, which appear as top-level headings in the book, should actually be second-level headings and should not be included in the Table of Contents (which is supposed to show only top-level headings):
- p10 "Displaying XML Documents"
- p11 "SGML, HTML, and XML"
- p169 "Declaring an Element with a Simple Type"
- p231 "Setting the font-variant Property"
- p309 "Using Paging"
page xviii, "caution" element
The desktop publishers removed the apostrophes from this "caution" element. The words havent, arent, and isnt should of course be haven't, aren't, and isn't.
page 56-57, "White Space in Elements" sidebar
In two places,
<VERSE>For the rare and radiant maiden<VERSE>
should be
<VERSE>For the rare and radiant maiden</VERSE>
(Thanks to Henry Hayden for discovering this error.)
page 62, figure at the beginning of the section "Adding Attributes to Elements"
The desktop publishers inserted the incorrect figure (a graphic showing the filename "Inventory04.xml"). The following is the correct figure:

page 72, figure showing the close up of the book namespace declaration
The figure is missing the http:// part of the namespace name. The following is the correct figure:

page 84, line of XML source near top of page
The words target and instruction should be italicized because they are placeholders, not the source that you literally type in:
<?target instruction ?>
page 118-119, Listing 5-1
The XML document 'Collection Default Valid.xml' (in Listing 5-1 and on the companion CD) generates a nonsensical error message when it's opened in Internet Explorer 5.5. I haven't thoroughly investigated the problem, but it appears that versions of MSXML prior to 3 don't support namespaces in DTDs. The problem should go away if you upgrade to IE 6 (which installs MSXML 3), or if you install MSXML 4 from the book's companion CD with an earlier version of IE. Please let me know about your experiences with this XML document.
page 156, table near bottom of page
The apostrophe and quote characters in the second column should be straight (' and "), not curly.
page 190, beginning of Listing 7-4
The desktop publishers duplicated the first two lines of this listing (the document is actually malformed as printed, and would generate a fatal parser error). The first part of the listing should be as follows:
Inventory Instance.xml
<?xml version="1.0"?> <!-- File Name: Inventory Instance.xml --> <INVENTORY> <BOOK InStock="true"> . . .
page 192, numbered item 2
The text,
2 Save the document on your hard disk, assigning it the filename Inventory Instance.xsd.
should be
2 Save the document on your hard disk, assigning it the filename Inventory Instance.xml.
page 258, figure at bottom of page
The desktop publishers inserted the incorrect figure (an oddly compressed version of a figure from a different chapter). Unfortunately, this is a key figure for this chapter. To view the correct figure, click here.
page 298, "Tip" element
"Using the C++ XML Data Source Object," should be "Use the C++ XML Data Source Object"
"Using the Master/Detail Feature with the C++ XML Data Source Object" should be "Use the Master/Detail Feature with the C++ XML Data Source Object"
page 389, Listings 11-7 and 11-8
The desktop publishers ran Listings 11-7 and 11-8 together. The lines between the two listings,
Listing 11-7
Inventory Entity.htm
should not be in monospace font (which makes them appear to be part of the listings).
Chapter 12
The expression "XSLT root node" used in this chapter confused at least one reader. The XSLT processor that's built into the browser reads the XML document and then constructs a hierarchical representation of the document. The "root node" of this XSLT hierarchy represents the entire XML document. By "XSLT root node" I therefore mean the root node of the hierarchical model of the XML document that is constructed by the XSLT system (representing the entire XML document). I suppose it would have been clearer—although considerably more awkward—to say something like "the root node of the XSLT model of the XML document" rather than "the XSLT root node," to make it clear that I'm not referring to the root or anything else about the XSLT file itself.
page 456, first paragraph following the source listing at top of page
"You could use the xsl:template element..." should be "You could use the xsl:attribute element..."



