You are previewing XML: Visual QuickStart Guide, Second Edition.
O'Reilly logo
XML: Visual QuickStart Guide, Second Edition

Book Description

What is XML? XML, or eXtensible Markup Language, is a specification for storing information. It is also a specification for describing the structure of that information. And while XML is a markup language (just like HTML), XML has no tags of its own. It allows the person writing the XML to create whatever tags they need. The only condition is that these newly created tags adhere to the rules of the XML specification.

In the seven years since the first edition of “XML: Visual QuickStart Guide” was published, XML has taken its place next to HTML as a foundational language on the Internet. XML has become a very popular method for storing data and the most popular method for transmitting data between all sorts of systems and applications. The reason being, where HTML was designed to display information, XML was designed to manage it.

This book begins by showing you the basics of the XML language. Then, by building on that knowledge, additional and supporting languages and systems will be discussed. To get the most out of this book, you should be somewhat familiar with HTML, although you don’t need to be an expert coder by any stretch. No other previous knowledge is required.

“XML: Visual QuickStart Guide, 2nd Edition” is divided into seven parts. Each part contains one or more chapters with step-by-step instructions that explain how to perform XML-related tasks. Wherever possible, examples of the concepts being discussed are displayed, and the parts of the examples on which to focus are highlighted.

The order of the book is intentionally designed to be an introduction to the fundamentals of XML, followed by discussions of related XML technologies.

    •    In Part 1 of the book, you will learn how to create an XML document. It’s relatively straightforward, and even more so if you know a little HTML.

    •    Part 2 focuses on XSL, which is a set of languages designed to transform an XML document into something else: an HTML file, a PDF document, or another XML document. Remember, XML is designed to store and transport data, not display it.

    •    Parts 3 and 4 of the book discuss DTD and XML Schema, languages designed to define the structure of an XML document. In conjunction with XML Namespaces (Part 5), you can guarantee that XML documents conform to a pre-defined structure, whether created by you or by someone else.

    •    Part 6, Developments and Trends, details some of the up-and-coming XML-related languages, as well as a few new versions of existing languages.

    •    Finally, Part 7 identifies some well-known uses of XML in the world today; some of which you may be surprised to learn.

This beginner’s guide to XML is broken down as follows:
    •    Introduction
    •    Chapter 1:  Writing XML

    •    Part 2:  XSL
    •    Chapter 2:  XSLT
    •    Chapter 3:  XPath Patterns and Expressions
    •    Chapter 4:  XPath Functions
    •    Chapter 5:  XSL-FO

    •    Part 3:  DTD
    •    Chapter 6:  Creating a DTD
    •    Chapter 7:  Entities and Notations in DTDs
    •    Chapter 8:  Validation and Using DTDs

    •    Part 4:  XML Schema
    •    Chapter 9:  XML Schema Basics
    •    Chapter 10:  Defining Simple Types
    •    Chapter 11:  Defining Complex Types

    •    Part 5:  Namespaces
    •    Chapter 12:  XML Namespaces
    •    Chapter 13:  Using XML Namespaces

    •    Part 6:  Recent W3C Recommendations
    •    Chapter 14:  XSLT 2.0
    •    Chapter 15:  XPath 2.0
    •    Chapter 16:  XQuery 1.0

    •    Part 7:  XML in Practice
    •    Chapter 17:  Ajax, RSS, SOAP and More
 

Table of Contents

  1. Copyright
    1. Dedication
  2. Foreword by Elizabeth Castro
  3. About the Author
  4. Thank You
  5. Image Copyrights
  6. Introduction
    1. What is XML?
    2. The Power of XML
    3. Extending XML
    4. XML in Practice
    5. About This Book
      1. A Guided Tour
      2. XML2e Companion Web Site
      3. From 2001 to 2008
    6. What This Book is Not
  7. 1. XML
    1. 1. Writing XML
      1. Tools for Writing XML
      2. An XML Sample
      3. Rules for Writing XML
        1. A root element is required
        2. Closing tags are required
        3. Elements must be properly nested
        4. Case matters
        5. Values must be enclosed in quotation marks
      4. Elements, Attributes, and Values
        1. White Space
      5. How To Begin
      6. Creating the Root Element
      7. Writing Child Elements
      8. Nesting Elements
      9. Adding Attributes
      10. Using Empty Elements
      11. Writing Comments
      12. Predefined Entities – Five Special Symbols
      13. Displaying Elements as Text
  8. 2. XSL
    1. 2. XSLT
      1. Transforming XML with XSLT
        1. Analyzing the source XML
        2. Assessing the XSLT style sheet
        3. Performing the transformation
      2. Beginning an XSLT Style Sheet
      3. Creating the Root Template
      4. Outputting HTML
      5. Outputting Values
      6. Looping Over Nodes
      7. Processing Nodes Conditionally
      8. Adding Conditional Choices
      9. Sorting Nodes Before Processing
      10. Generating Output Attributes
      11. Creating and Applying Templates
    2. 3. XPath Patterns and Expressions
      1. Locating Nodes
        1. The XML Node Tree
        2. Location Paths
        3. Using Located Nodes
      2. Determining the Current Node
      3. Referring to the Current Node
      4. Selecting a Node’s Children
      5. Selecting a Node’s Parent or Siblings
      6. Selecting a Node’s Attributes
      7. Conditionally Selecting Nodes
      8. Creating Absolute Location Paths
      9. Selecting All the Descendants
    3. 4. XPath Functions
      1. Comparing Two Values
      2. Testing the Position
      3. Multiplying, Dividing, Adding, Subtracting
      4. Counting Nodes
      5. Formatting Numbers
      6. Rounding Numbers
      7. Extracting Substrings
      8. Changing the Case of a String
      9. Totaling Values
      10. More XPath Functions
    4. 5. XSL-FO
      1. The Two Parts of an XSL-FO Document
      2. Creating an XSL-FO Document
      3. Creating and Styling Blocks of Page Content
      4. Adding Images
      5. Defining a Page Template
      6. Creating a Page Template Header
      7. Using XSLT to Create XSL-FO
      8. Inserting Page Breaks
      9. Outputting Page Content in Columns
      10. Adding a New Page Template
  9. 3. DTD
    1. 6. Creating a DTD
      1. Working with DTDs
      2. Defining an Element That Contains Text
      3. Defining an Empty Element
      4. Defining an Element That Contains a Child
      5. Defining an Element That Contains Children
      6. Defining How Many Occurrences
      7. Defining Choices
      8. Defining an Element That Contains Anything
      9. About Attributes
      10. Defining Attributes
      11. Defining Default Values
      12. Defining Attributes with Choices
      13. Defining Attributes with Unique Values
      14. Referencing Attributes with Unique Values
      15. Restricting Attributes to Valid XML Names
    2. 7. Entities and Notations in DTDs
      1. Creating a General Entity
      2. Using General Entities
      3. Creating an External General Entity
      4. Using External General Entities
      5. Creating Entities for Unparsed Content
      6. Embedding Unparsed Content
      7. Creating and Using Parameter Entities
      8. Creating an External Parameter Entity
    3. 8. Validation and Using DTDs
      1. Creating an External DTD
      2. Declaring an External DTD
        1. To declare an external DTD:
      3. Declaring and Creating an Internal DTD
        1. To declare and create an internal DTD:
      4. Validating XML Documents Against a DTD
      5. Naming a Public External DTD
        1. To name an external DTD:
      6. Declaring a Public External DTD
        1. To declare a public external DTD:
      7. Pros and Cons of DTDs
  10. 4. XML Schema
    1. 9. XML Schema Basics
      1. Working with XML Schema
      2. Beginning a Simple XML Schema
      3. Associating an XML Schema with an XML Document
      4. Annotating Schemas
    2. 10. Defining Simple Types
      1. Defining a Simple Type Element
      2. Using Date and Time Types
      3. Using Number Types
      4. Predefining an Element’s Content
      5. Deriving Custom Simple Types
      6. Deriving Named Custom Types
      7. Specifying a Range of Acceptable Values
      8. Specifying a Set of Acceptable Values
      9. Limiting the Length of an Element
      10. Specifying a Pattern for an Element
      11. Limiting a Number’s Digits
      12. Deriving a List Type
      13. Deriving a Union Type
    3. 11. Defining Complex Types
      1. Complex Type Basics
        1. The Four Complex Types
        2. XML Schema Type Hierarchy
        3. Deriving a Complex Type
        4. The Default Condition
      2. Deriving Anonymous Complex Types
      3. Deriving Named Complex Types
      4. Defining Complex Types That Contain Child Elements
      5. Requiring Child Elements to Appear in Sequence
      6. Allowing Child Elements to Appear in Any Order
      7. Creating a Set of Choices
      8. Defining Elements to Contain Only Text
      9. Defining Empty Elements
      10. Defining Elements with Mixed Content
      11. Deriving Complex Types from Existing Complex Types
      12. Referencing Globally Defined Elements
      13. Controlling How Many
      14. Defining Named Model Groups
      15. Referencing a Named Model Group
      16. Defining Attributes
      17. Requiring an Attribute
      18. Predefining an Attribute’s Content
      19. Defining Attribute Groups
      20. Referencing Attribute Groups
      21. Local and Global Definitions
  11. 5. Namespaces
    1. 12. XML Namespaces
      1. Designing a Namespace Name
      2. Declaring a Default Namespace
      3. Declaring a Namespace Name Prefix
      4. Labeling Elements with a Namespace Prefix
      5. How Namespaces Affect Attributes
    2. 13. Using XML Namespaces
      1. Populating an XML Namespace
      2. XML Schemas, XML Documents, and Namespaces
      3. Referencing XML Schema Components in Namespaces
      4. Namespaces and Validating XML
      5. Adding All Locally Defined Elements
      6. Adding Particular Locally Defined Elements
      7. XML Schemas in Multiple Files
      8. XML Schemas with Multiple Namespaces
      9. The Schema of Schemas as the Default
      10. Namespaces and DTDs
      11. XSLT and Namespaces
  12. 6. Recent W3C Recommendations
    1. 14. XSLT 2.0
      1. Extending XSLT
      2. Creating a Simplified Style Sheet
      3. Generating XHTML Output Documents
      4. Generating Multiple Output Documents
      5. Creating User Defined Functions
      6. Calling User Defined Functions
      7. Grouping Output Using Common Values
      8. Validating XSLT Output
    2. 15. XPath 2.0
      1. XPath 1.0 and XPath 2.0
        1. XPath Basics
        2. XPath 2.0 Data Model
        3. XPath 2.0 Sequences
      2. Averaging Values in a Sequence
      3. Finding the Minimum or Maximum Value
      4. Formatting Strings
      5. Testing Conditions
      6. Quantifying a Condition
      7. Removing Duplicate Items
      8. Looping Over Sequences
      9. Using Today’s Date and Time
      10. Writing Comments
      11. Processing Non-XML Input
    3. 16. XQuery 1.0
      1. XQuery 1.0 vs. XSLT 2.0
      2. Composing an XQuery Document
      3. Identifying an XML Source Document
      4. Using Path Expressions
      5. Writing FLWOR Expressions
      6. Testing with Conditional Expressions
      7. Joining Two Related Data Sources
      8. Creating and Calling User Defined Functions
      9. XQuery and Databases
  13. 7. XML in Practice
    1. 17. Ajax, RSS, SOAP, and More
      1. Ajax Basics
        1. The Technology of Ajax
        2. Using Ajax
      2. Ajax Examples
        1. Google Suggest
        2. Netflix: Star Ratings
        3. Yahoo! Finance
      3. RSS Basics
      4. RSS Schema
      5. Extending RSS
        1. Media RSS module
        2. blogChannel RSS module
        3. Podcasting and iTunes
      6. SOAP and Web Services
      7. SOAP Message Schema
      8. WSDL
        1. WSDL Schema
        2. UDDI
      9. KML Basics
      10. A Simple KML File
        1. Placemarks
      11. ODF and OOXML
        1. ODF
        2. OOXML
        3. Comparison and Controversy
      12. eBooks, ePub, and More
        1. ePub
      13. Tools for XML in Practice
        1. Ajax
        2. RSS
        3. SOAP and WSDL
        4. KML
        5. ODF and OOXML
        6. ePub
  14. Appendices
    1. A. XML Tools
      1. XML Editors
        1. XML Copy Editor
        2. EditiX XML Editor
        3. Altova XMLSpy
        4. Oxygen XML Editor
      2. Additional XML Editors
        1. XMLwriter XML Editor
        2. Stylus Studio
        3. Liquid XML Studio
        4. WMHelp XMLPad
        5. XMLmind XML Editor
      3. XML Tools and Resources
    2. B. Character Sets and Entities
      1. Specifying the Character Encoding
        1. Character Encodings
      2. Using Numeric Character References
      3. Using Entity References
      4. Unicode Characters