You are previewing XML Pocket Consultant.
O'Reilly logo
XML Pocket Consultant

Book Description

This pocket-sized resource is your fast-answers guide to the latest XML standards and technologies, including XML schemas, XSL, XLink, and XPath. Get critical details through quick-reference tables, lists, step-by-step instructions, and sample code.

Table of Contents

  1. XML Pocket Consultant
    1. Tables
  2. Acknowledgements
  3. Introduction
    1. Who Is This Book For?
    2. How Is This Book Organized?
    3. Conventions Used in This Book
    4. Support
  4. I. XML Essentials
    1. 1. Introducing XML
      1. XML Basics
      2. Using XML
      3. Extensions to XML
        1. XLink and XPointer
        2. XSL
        3. XML Namespaces
        4. XML Schema
        5. XPath
      4. Creating XML-Based Solutions
        1. Authoring Tools
        2. Application Development Environments
        3. Database and Data Integration Solutions
    2. 2. XML Document Structure
      1. XML Naming Rules
      2. Working with Root, Parent, and Child Elements
        1. Understanding Root Elements
        2. Understanding Parent and Child Elements
        3. Nesting Parent and Child Elements
        4. Adding Root Elements to Documents
      3. Defining XML Elements and Tags
        1. Using Elements with Beginning and Ending Tags
        2. Using Empty Elements
      4. Using XML Attributes
        1. Defining Attributes
        2. When to Use Attributes
        3. Adding Attributes to Elements
      5. Working with Entity References, Character Data, Comments, and Processing Instructions
        1. Using Predefined Entity References
        2. Using Character Data Sections
        3. Using Comments
        4. Using Processing Instructions
      6. Specifying XML Declarations
        1. Using the Version Attribute
        2. Using the Encoding Attribute
        3. Using the Standalone Attribute
      7. Creating Well-Formed Documents
  5. II. DTDs and Namespaces
    1. 3. Creating DTDs
      1. Understanding DTDs
      2. Working with Internal DTDs
        1. Declaring Internal DTDs
        2. Adding Internal DTDs to Documents
      3. Working with External DTDs
        1. Declaring Public External DTDs
        2. Adding Public External DTDs to Documents
        3. Declaring Nonpublic External DTDs
        4. Adding Nonpublic DTDs to Documents
        5. Resolving Errors with Externally Referenced DTDs
      4. Combining Internal and External DTDs
        1. Adding Internal and External DTDs to Documents
        2. Writing External DTD Files
    2. 4. XML Elements in DTDs
      1. Defining Elements in DTDs
        1. Declaring Elements with Standard Content
        2. Declaring Elements with Character Data Only
        3. Declaring Elements with Mixed Content
        4. Declaring Elements with Any Content Allowed
        5. Declaring Elements with No Content Allowed
      2. Structuring Elements
        1. Understanding Element Order Indicators and Qualifiers
        2. Specifying Sequences
        3. Specifying Choices
        4. Specifying Groups
          1. Using Grouping to Specify Choices Within Sequences
          2. Using Grouping to Specify Sets of Choices with Specific Sequences
        5. Specifying the Number of Child Elements
          1. Qualifying Child Elements
          2. Qualifying Groups of Sequences or Choices
          3. Using Qualifiers to Specify Minimum Requirements
    3. 5. XML Attributes in DTDs
      1. Defining Attributes in DTDs
        1. Making Attribute Assignments
        2. Specifying Attribute Names, Types, and Default Usages
          1. Defining Attribute Names
          2. Defining Attribute Types
          3. Defining Attribute Default Usages
          4. Using Attribute Types and Default Usages in DTDs
        3. Assigning Values to Attributes in DTDs
      2. Declaring Standard Attribute Types in DTDs
        1. Defining CDATA Attribute Types
        2. Restricting Attribute Values Using Name Tokens
        3. Defining Enumerated Attribute Types
        4. Defining Attributes with Unique Values
        5. Referencing Attributes with Unique Values
          1. Using an IDREF Attribute Type
          2. Using an IDREFS Attribute Type
    4. 6. XML Entities and Notations in DTDs
      1. Getting Started with Entities and Notations
      2. Working with General Entities in DTDs
        1. Using Internal General Entities
          1. Defining Substitution Text
          2. Defining Markup for Replacement
          3. Internal General Entities Dos and Don’ts
          4. Defining the Internal General Entity in a DTD
        2. Using External Parsed General Entities
          1. External Parsed General Entity Dos and Don’ts
          2. Declaring External Parsed General Entities
          3. Creating the External File for the Entity
          4. Defining the External Parsed General Entity in a DTD
        3. Using External Unparsed General Entities
          1. Declaring External Unparsed General Entities
          2. Embedding Unparsed Content in Documents
            1. Declaring ENTITY Attributes
            2. Declaring ENTITIES Attributes
      3. Working with Parameter Entities in DTDs
        1. Using Internal Parameter Entities
        2. Using External Parameter Entities
      4. Using Encoded Characters
        1. Setting Language Encoding with xml:lang
        2. Declaring the xml:lang Attribute for Validated Documents
        3. Specifying Character References
        4. Creating Entities to Reference Characters
    5. 7. XML Namespaces
      1. Understanding Namespaces
      2. Creating Namespaces
        1. Declaring Namespaces
        2. Associating URIs with Namespaces
        3. Setting Default Namespaces
      3. Using Namespaces with DTDs
        1. Using Namespaces with Elements in DTDs
        2. Using Namespaces with Attributes in DTDs
        3. Declaring xmlns Attributes
  6. III. XML Schemas
    1. 8. XML Schemas
      1. Getting Started with Schemas
        1. Understanding Simple and Complex Types
        2. Understanding Local and Global Declarations
      2. Working with Basic Schemas
        1. Creating a Basic Schema Document
          1. Using a Specific Namespace
          2. Using the Default Namespace
        2. Associating the Schema with an XML Document
          1. Referencing Schema Instances Using noNamespaceSchemaLocation
          2. Referencing Schema Instances Using schemaLocation
        3. Adding Documentation to Schemas
        4. Adding Comments to Schemas
      3. Using Targeted Namespaces with Schemas
        1. Targeting Namespaces: The Essentials
        2. Adding Elements to Target Namespaces
        3. Adding Attributes to Target Namespaces
        4. Referencing Components with Namespaces
      4. Including and Importing Schemas
        1. Including Multiple Schema Files
        2. Importing Multiple Schema Files
    2. 9. Defining Simple Types in Schema
      1. Making Simple Element and Attribute Declarations
        1. Declaring Simple Elements with Character Content
        2. Declaring Default and Fixed Values for Simple Elements
        3. Declaring Simple Empty Elements
        4. Declaring Simple Attributes
        5. Declaring Default and Fixed Values for Simple Attributes
        6. Creating Optional, Required, and Prohibited Simple Attributes
      2. Creating Simple Types
        1. Using Values Derived by Restriction
          1. Declaring Elements and Attributes with Restrictions
          2. Using Named Custom Types
          3. Using Anonymous Custom Types
        2. Using Values Derived by List
          1. Creating Lists
          2. Understanding How Lists Use Whitespace
          3. Creating List Definitions in Schema
        3. Using Values Derived by Union
          1. Creating Unions
          2. Understanding the Order of Union Member Types
          3. Creating Union Definitions in Schema
    3. 10. Specifying Datatypes and Restrictions in Schema
      1. Using String and Name Datatypes
        1. Defining a string Datatype
        2. Defining a normalizedString Datatype
        3. Defining a token Datatype
        4. Defining Other string Datatypes
      2. Using Date and Time Datatypes
        1. Using the duration Datatype
          1. Formatting duration Values
          2. Declaring a duration in Schema
        2. Using the dateTime Datatype
          1. Formatting dateTime Values
          2. Setting Negative dateTime Values
          3. Setting Time Zones
          4. Declaring a dateTime Value in Schema
        3. Using the time Datatype
        4. Using the date Datatype
        5. Using the gYear, gYearMonth, gMonthDay, gMonth, and gDay Datatypes
      3. Using Numeric Datatypes
        1. Working with the Decimal Datatype and Its Derivatives
          1. Defining decimal Datatypes
          2. Defining integer Datatypes
        2. Working with Floating-Point Datatypes
          1. Using Floating-Point Values
          2. Defining float and double Datatypes in Schema
      4. Using Other Datatypes
        1. Using boolean Datatypes
        2. Using Binary Datatypes
        3. Using URI Datatypes
      5. Controlling Acceptable Values
        1. Specifying a Set of Acceptable Values
        2. Specifying Expressions for Acceptable Values
          1. Representing a Series of Values
          2. Using Groups, Occurrence Indicators, and Choices
          3. Using Quantity Indicators
          4. Using Literal Values and Single Character Expressions
          5. Defining a Pattern for a Simple Type
        3. Specifying Acceptable Whitespace Characters
        4. Specifying a Range of Acceptable Values
        5. Limiting the Length of Values
        6. Limiting the Number of Digits
    4. 11. Defining Complex Types in Schema
      1. Working with Complex Types
        1. Declaring Elements with Named Complex Types
        2. Declaring Elements with Anonymous Complex Types
        3. Basing Complex Types on Complex Types
          1. Extending a Complex Type Based on an Existing Complex Type
          2. Restricting a Complex Type to a Subset of Another Type
      2. Defining Content for Complex Elements
        1. Defining Complex Elements with Standard Content
        2. Defining Complex Elements with Mixed Content
        3. Defining Complex Elements with Text-Only Content
        4. Defining Complex Elements with No Content
      3. Structuring Complex Elements in Schemas
        1. Specifying Sequences
        2. Specifying Choices
        3. Allowing Elements to Appear in Any Order
        4. Controlling Element Occurrence
      4. Using Groups and References
        1. Defining and Referencing Element Groups
        2. Defining and Referencing Attribute Groups
        3. Referencing Globally Declared Elements
    5. 12. Content Models for Schema Declarations
      1. all Definitions
      2. annotation Definitions
      3. any Definitions
      4. anyAttribute Definitions
      5. attribute Definitions
      6. attributeGroup Definitions and References
      7. choice Definitions
      8. complexType Definitions
        1. Complex Type with Simple Content
        2. Complex Type with Complex Content
      9. element Definitions
      10. Element group Definitions and References
      11. import Definitions
      12. include Definitions
      13. notation Definitions
      14. schema Definitions
      15. selector and field Definitions
      16. sequence Definitions
      17. simpleType Definitions
      18. unique Constraint Definitions
  7. IV. XSLT and XPath
    1. 13. XSL Transformations and Formatting
      1. Introducing XSLT
      2. Matching Document Structures to Template Rules
        1. Understanding the Built-In Template for Element and Root Nodes
        2. Understanding the Built-In Template for Modes
        3. Understanding the Built-In Template for Text and Attribute Nodes
        4. Understanding Other Built-In Templates
      3. Structuring XSLT Stylesheets
        1. Starting the XSLT Stylesheet
        2. Defining the Output Format
          1. Setting Attributes for the output Element
          2. Formatting Output as XML or XML-Based Markup
          3. Formatting Output as HTML
          4. Formatting Output as Text or Program Source Code
          5. Setting the Output Format
        3. Defining Template Rules and Declarations
          1. Creating the Root Template
          2. Creating and Applying Template Rules
          3. Outputting the Contents of Nodes
    2. 14. XPath Operators and Expressions
      1. Understanding Location Paths
      2. Understanding XPath Operators and Datatypes
      3. Using Relative XPath Expressions with Elements
        1. Referencing the Current Context Node
        2. Referencing a Parent Node
        3. Referencing Siblings Relative to the Current Context
        4. Referencing Child Nodes
      4. Using Absolute XPath Expressions with Elements
      5. Locating Attribute, Text, Comment, and Processing Instruction Nodes
        1. Working with Attribute Nodes
        2. Working with Text Nodes
        3. Working with Comment Nodes
        4. Working with Processing Instruction Nodes
      6. Using Namespaces with Element and Attribute Nodes
      7. Using Wildcards and Predicates in XPath Expressions
        1. Selecting Any Node
        2. Skipping Levels in the Hierarchy
        3. Filtering to Match Nodes with Specific Values
          1. Using Numeric Positions in Predicates
          2. Using Functions in Predicates
          3. Using Attribute Values in Predicates
          4. Specifying the Node Subset in a Stylesheet
    3. 15. Branching and Control Functions
      1. Processing Nodes Conditionally with if Statements
      2. Processing Nodes Conditionally with choose-when and choose-when-otherwise Statements
      3. Processing Multiple Nodes with for-each Statements
      4. Invoking, Including, and Importing Templates
        1. Including and Importing Templates
          1. Defining Include Statements
          2. Defining Import Statements
        2. Calling Templates by Name
        3. Invoking Templates by Mode
    4. 16. Variables and Parameters in XSLT
      1. Working with Parameters
        1. Defining and Referencing Parameters
        2. Setting Default Values for Parameters
        3. Passing Parameter Values to Templates
        4. Using Global Parameters
      2. Working with Variables
        1. Defining Variables
        2. Referencing Variables
        3. Using Global Variables
    5. 17. Working with Strings, Booleans, and Numbers
      1. Manipulating Strings
        1. Converting Values to Strings
        2. Managing Spaces Within Strings
        3. Normalizing Space in Strings
        4. Merging Values into a Single String
        5. Examining and Manipulating String Contents
          1. Determining If a String Contains Another String
          2. Determining String Length
          3. Determining If a String Starts with Another String
          4. Extracting a Substring
          5. Returning a Substring Before Another String
          6. Returning a Substring After Another String
        6. Translating Characters in Strings
      2. Converting and Manipulating Boolean Values
        1. Using the true() Function
        2. Using the false() Function
        3. Using the not() Function
      3. Working with Numeric Values
        1. Converting Values to Numbers
        2. Formatting Values as Numbers
          1. Specifying the Default and Alternative Number Formatting
          2. Defining the Exact Number Format for Output
        3. Rounding Numbers
          1. Using the round() Function
          2. Using the ceiling() Function
          3. Using the floor() Function
        4. Summing Values
    6. 18. Restructuring Input Documents and Manipulating Document Subsets
      1. Combining and Merging Documents
        1. Document Merging Essentials
        2. Using Base Paths with the document() Function
        3. Using the document() Function To Process the Stylesheet Itself
        4. Declaring the document() Function in a Stylesheet
      2. Manipulating Document Structures
        1. Creating Copies of Node Sets
        2. Generating Elements and Attributes in the Output
          1. Using xsl:element
          2. Using xsl:attribute-set and xsl:attribute
      3. Sorting Document Structures
        1. Sorting Essentials
        2. Defining Sort Keys, Order, and Type
        3. Sorting Nodes in a Document
      4. Counting Nodes
  8. A. About the Author
  9. Index
  10. About the Author
  11. Copyright