You are previewing XQuery Kick Start.
O'Reilly logo
XQuery Kick Start

Book Description

XQuery Kick Start delivers a concise introduction to the XQuery standard, and useful implementation advice for developers needing to put it into practice. The book starts by explaining the role of XQuery in the XML family of specifications, and its relationship with XPath. The authors then explain the specification in detail, describing the semantics and data model, before moving to examples using XQuery to manipulate XML databases and document storage systems. Later chapters discuss Java implementations of XQuery and development tools that facilitate the development of Web sites with XQuery. This book is up to date with the latest XQuery specifications, and includes coverage of new features for extending the XQuery language.

Table of Contents

  1. Copyright
    1. Dedication
  2. About the Authors
    1. James McGovern
    2. Kurt Cagle
    3. Per Bothner
    4. James Linn
    5. Vaidyanathan Nagarajan
  3. Acknowledgments
    1. The Author Team
    2. James McGovern
    3. Kurt Cagle
    4. Per Bothner
    5. James Linn
    6. Vaidyanathan Nagarajan
  4. We Want to Hear from You!
  5. Introduction
    1. Audience
    2. Contents of this Book
    3. What this Book Is Not
    4. Source Code
  6. I. XML Concepts
    1. 1. XML: The Foundation of XQuery
      1. Background
      2. What XML Offers
      3. Portable Data
      4. How XML Works
        1. Rules of XML
        2. XML Validation
      5. The Evolution of XML
      6. The XML Family
        1. XSL
        2. XPath
          1. XPath Expressions
          2. Navigation in XPath
          3. XPath Functions
          4. Node Tests
          5. XPath Wildcards
          6. Unabbreviated XPath Syntax
          7. XPath Selection Syntax
        3. XSLT
        4. XPointer
        5. XLink
      7. In Brief
    2. 2. Understanding the XPath 2.0 Specification
      1. In Search of Context: XQuery and XPath
      2. The Need for XPath
      3. Directories and Nodes
        1. Addressing
      4. XPath 1.0
      5. XPath 2.0's New Features
      6. Understanding Sequences
        1. Sequences Versus Node-sets
        2. Enumerating with the to Operator
        3. Functions Acting On Sequences
          1. Understanding the Core Sequences Functions
        4. Manipulating Set Functions
      7. Handling Aggregate Functions
      8. The tokenize() Function
      9. Working with External Resources
      10. Cutting Verbosity with XPath Command Structures
        1. Using if-then-else
        2. Using for-return
        3. Building a Custom Switch Structure
      11. Regular Expressions
        1. The matches() Function
        2. The replace() Function
        3. Flags
        4. The tokenize() Function
      12. Of Data Types and Dates
        1. Types and XML
        2. Types and XPath
        3. Dealing with Dates
      13. In Brief
  7. II. The XQuery Language
    1. 3. XQuery Language Expressions
      1. The Need for XQuery
      2. Why Not SQL?
      3. XSLT and XPath as Query Languages
      4. The Structure of XQuery
      5. Assignments with let
      6. Iterations with for
      7. Returning Results
      8. where Oh where?
      9. Ordering Up Some XQuery
      10. Conditional Logic
        1. I Ain't Got No…
      11. Defining Functions
        1. Namespaces
        2. Code Libraries
      12. In Brief
    2. 4. Extensions and Modular XQuery
      1. Extending XQuery with Libraries
      2. Enhancing XQuery with Pragmas and Extensions
        1. Processing with Pragmas
        2. Understanding Must-Understand Extensions
      3. Importing Modules
        1. Borrowing Library Modules
        2. Calling Imported Variables
        3. Importing XML Schema
      4. Invoking External Functions
      5. Using Library Modules Effectively
        1. Organizing Libraries
        2. Compiling XQuery
      6. In Brief
    3. 5. XQuery Applications: Presentations, Graphics, and Syndication Feeds
      1. Viewing XML
      2. Creating an XQuery Pipeline
      3. HTML: A Regional Weather Report
      4. Making the Table More Sophisticated
      5. Parameterized XQuery
      6. SVG: Graphing from XQuery
        1. Graphing Weather Trends
      7. Syndication with RSS
      8. Building an XQuery Syndication Engine
        1. Querying the RSS Feed
        2. Root Node Queries in XQuery
        3. Generating XML from PostgreSQL
      9. In Brief
    4. 6. Working with the XPath 2.0 Data Model
      1. XML Infosets
      2. Node Values and Types
        1. Node Identity and Hierarchy
        2. String Value and Typed Value of Nodes
      3. Types and Type Systems
        1. The Data Model: Items and Sequences
        2. Atomic Values and Types
      4. Schemas and Complex Types
      5. Validation Produces Type Annotations
      6. Sequence Types
      7. Static Typing
      8. In Brief
    5. 7. Understanding XQuery Semantics
      1. XQuery Semantics Introduction
      2. Processing Model for XQuery
      3. Differences Between XQuery and XQuery Core
        1. XQuery-to-XQuery Core Mapping: An Example
        2. Expression Level
        3. Type Level
      4. XQuery Data Model
        1. Atomic Value
        2. Node
        3. Sequences
        4. Node Identity
        5. Order
      5. Schemas and Types
        1. Type Annotations and Anonymous Types
        2. Subtyping Rules
      6. Functions
        1. Examples
        2. Other Functions
      7. Notation
        1. Inference Rules
        2. Normalization
      8. Expression of Semantics in XQuery
      9. Type Level
        1. XQuery Types
        2. Prime Types
      10. Function Semantics
      11. In Brief
    6. 8. XQuery and Databases
      1. Relational Database Concepts
      2. A Relational-to-Object Database: Concept Mapping
        1. Transactions
      3. SQL Concepts
        1. Data Manipulation Language (DML)
        2. Data Definition Language (DDL)
      4. Relational Technology
      5. Oracle 9i XQuery Support
        1. JXQI
          1. Installing JXQI
          2. Coding Using the JXQI API
          3. Using JXQI to Connect to an Oracle Database
      6. IBM DB2 XQuery Support
      7. GoXML DB XQuery Support
        1. GoXML DB Product Design
        2. XQuery Support in GoXML
      8. In Brief
    7. 9. Advanced XQuery Topics
      1. XML and Documents
        1. The Semantic Web
          1. Resource Definition Framework
          2. Ontologies
          3. Opportunities Created by the Semantic Web
        2. XML and Document Publishing
      2. XML Design for Data Storage
        1. Basic Requirements for Data Storage
          1. Fundamentals of RDBMS
          2. RDBMS Mechanisms to Ensure Data Integrity
          3. Other RDBMS Transaction Integrity Mechanisms
          4. Importance of Indexing
          5. RDBMSs and Metadata
          6. Transaction Services in an RDBMS
          7. Security Services in an RDBMS
          8. Concurrency Control
          9. Transaction Control
          10. Locking Mechanisms
          11. Importance of SQL
        2. XML Paradigm for Data Storage
        3. Persistence Strategies for XML
        4. XML Structure and its Relationship To Persistence
        5. RDBMS XML Persistence Strategies
          1. Shredding
          2. Native Storage
        6. XML Databases
        7. Persistent Storage of Data-centric XML
      3. XQuery Limitations
        1. XQuery As a Declarative Language
        2. GUI XQuery Tools
        3. XQuery and CRUD
      4. In Brief
  8. III. Using XQuery
    1. 10. Using Microsoft XQuery Services
      1. Microsoft XQuery Services
      2. Example
      3. Additional Examples
      4. XQuery Classes
      5. In Brief
    2. 11. Generating XML and HTML Using XQuery
      1. Tools for Generating Web Pages
      2. A Photo Album Application
      3. Generating the Overview Page
        1. A Slight Refinement
      4. Generating the Picture Pages
      5. Running XQuery Programs as Servlets
        1. Installing the Servlet Under the Tomcat Server
        2. Comparison with JavaServer Pages
      6. Running XQuery Programs from CGI Scripts
      7. Comparing XSLT and XQuery
        1. Transforming Docbook to HTML Using XSLT
        2. Transforming Docbook to HTML Using XQuery
      8. In Brief
    3. 12. Working with Java and XQuery
      1. Qexo: An XQuery-to-Java Compiler
      2. Running Qexo
        1. Running the Qexo Application
        2. Interactive Use
        3. Running XQuery Programs
        4. Compiling an XQuery Program to an Application
        5. Running XQuery Servlets in a Web Server
        6. Calling Java Methods from XQuery
        7. Calling XQuery Expressions from Java
        8. Using Qexo with SAX2
        9. The Consumer Interface
        10. The TreeList DOM Class
      3. XQEngine
        1. Features of XQEngine
        2. XQEngine APIs
        3. Using the XQEngine API
      4. In Brief
  9. IV. Appendixes
    1. A. XML Fundamentals
      1. Processing Models for XML Data
      2. XML Documents
      3. XML Documents and DTDs
      4. Well-Formedness and Validity of XML Documents
      5. XML Syntax and Semantics
        1. XML Declaration
        2. DTD Declaration
        3. Root Element
        4. Tag Attributes
        5. Comments
        6. Empty Elements
        7. CDATA
      6. Entity References
      7. Rules for Writing XML
        1. Root Element Is Required
        2. Closing Tags Are Necessary
        3. Proper Nesting of Elements
        4. Case Matters
        5. Whitespace
        6. Quotations Are Needed for Attribute Values
        7. Entity References Should Be Declared
          1. DTD Elements
      8. CDATA Section
    2. B. Other Sources of Information
      1. Specifications
      2. Books
        1. Bibliography
      3. List Servers
      4. Implementations