You are previewing Oracle Database 10g XML & SQL: Design, Build & Manage XML Applications in Java, C, C++ & PL/SQL.
O'Reilly logo
Oracle Database 10g XML & SQL: Design, Build & Manage XML Applications in Java, C, C++ & PL/SQL

Book Description

Written by members of the Oracle XML group, this is a must-have reference for all IT managers, DBAs, and developers who want to learn the best practices for using XML with Oracle's XML-enabled products. Includes real-world case studies based on the authors' experience managing Oracle's XML Discussion Forum--a community of 20,000+ XML component users.

Table of Contents

  1. Cover Page
  2. Oracle Database 10g XML & SQL: Design, Build & Manage XML Applications in Java, C, C++ & PL/SQL
  3. Copyright Page
  4. Contents
  5. Introduction
  6. Part I Oracle and the XML Standards
    1. 1 Introducing XML
      1. What Is an XML Document?
      2. The Prolog
      3. The Body
      4. Well-Formed XML Documents
      5. Valid XML Documents
      6. XML Namespaces
      7. XML and the Database
      8. Database Schema and XML Documents
      9. Mapping XML Documents to a Database Schema
      10. Summary
    2. 2 Accessing XML with DOM, SAX, JAXB, and StAX
      1. Parsing and Binding an XML Document
      2. Accessing XML Using the DOM
      3. Introducing the DOM APIs
      4. DOM Level 2
      5. DOM Level 3
      6. Oracle DOM APIs in C
      7. Accessing XML with SAX
      8. SAX Level 1 and Level 2
      9. Using SAX APIs
      10. Oracle SAX APIs in C
      11. Accessing XML with Java Binding
      12. The Input XML Schema
      13. Generating XML Classes
      14. Binding to an XML Instance
      15. XML Document Created by Java Application
      16. Accessing XML with StAX
      17. Best Practices
      18. DTD Caching
      19. Skipping the <!DOCTYPE> Tag
      20. Cutting and Pasting Across Documents
    3. 3 Transforming XML with XSLT and XPath
      1. Programmatic Invocation of the XSLT Processor
      2. Navigating XML with XPath
      3. XPath Expressions
      4. Introducing XSLT Stylesheets
      5. XSL Templates
      6. The XSLT Process Model
      7. <xsl:apply-imports>
      8. <xsl:apply-templates>
      9. Introducing XSLT 2.0
      10. Grouping
      11. Function Definitions
      12. Multiple Result Documents
      13. Temporary Trees
      14. The Oracle XSLT Extensions
      15. Useful Built-in Java Oracle XSLT Extensions
      16. The XSLT Virtual Machine
      17. XSLT and the Database
      18. Best Practices
      19. Tuning Tips for XSLT
      20. The document() Function in XSLT
      21. Improving the Overall Performance of XSLT for Multiple Transformations
    4. 4 Validating XML with DTDs and XML Schemas
      1. Introducing the DTD
      2. Validating XML Against DTDs
      3. Introducing the XML Schema Language
      4. Simple and Complex Datatypes
      5. Validating XML with XML Schemas (XSDs)
      6. XML Document Models and the Database
      7. Mapping DTDs to Database Schemas
      8. Mapping XML Documents to a Database Schema
      9. Supported Database Mappings
      10. Best Practices
      11. Designing Your Schema
      12. Elements vs. Attributes
      13. Designing Element and Attribute Names
      14. Loading External DTDs from a JAR File
    5. 5 XML Operations with XQuery
      1. Introducing XQuery
      2. Basics
      3. Expressions
      4. Query Prolog
      5. Introducing XQueryX
      6. The Oracle XQuery Engine
      7. Setting Up the Environment
      8. Testing Your Installation
      9. Querying XML Documents
      10. Running in Interactive Mode
      11. Querying XML from the Command Line
      12. Querying XML with XQueryX
      13. XQuery and the Oracle Database
      14. XQuery API for Java
      15. Querying XML in the Database
      16. Best Practices
      17. XQuery Versus XSLT 2.0
      18. XQuery Versus SQL/XML
    6. 6 XML Messaging and RPC with SOAP
      1. Introducing SOAP
      2. Literal, Encoded SOAP Messages
      3. One-Way and Two-Way SOAP Messaging and RPCs
      4. Using SOAP and the Oracle XDK
      5. SOAP Client
      6. SOAP Server
      7. SOAP Handlers
      8. Using SOAP and the Oracle Database
      9. Oracle Streams AQ Support
      10. AQ Servlet
      11. Enqueuing and Dequeuing Messages
      12. Using SOAP from PL/SQL
      13. Best Practices
      14. SOAP vs. JAX-RPC
      15. SOAP vs. JMS
    7. 7 Putting It All Together with XML Pipeline, JSPs, and XSQL
      1. Introducing the XML Pipeline Processor
      2. Multistage XML Processing
      3. Processing XML with JSPs and XML Beans
      4. DOMBuilder Bean
      5. XSLTransformer Bean
      6. DBAccess Bean
      7. XMLDBAccess Bean
      8. XMLDiff Bean
      9. XMLCompress Bean
      10. XSDValidator Bean
      11. Using XML Beans in JSPs
      12. Introducing the XSQL Page Publishing Framework
      13. The XSQL Pages
      14. Installing the XSQL Servlet
      15. Submitting Queries to the XSQL Servlet
      16. Transforming the XSQL Output with Stylesheets
      17. Inserting XML Documents with the XSQL Servlet
      18. Updating Data with the XSQL Servlet
      19. Using JSPs and XSQL Pages
      20. Best Practices
      21. Creating a More Secure Connection
      22. When You Need Simple JSP XML Functionality
  7. Part II Oracle XML Management for DBAs
    1. 8 Getting Started with the Oracle XML Database
      1. A Brief History of XML Support in Oracle Database
      2. Setting Up the Oracle XML Database
      3. Installing Oracle XML Database
      4. Installing the Sample Database Schemas
      5. Creating a User to Run the XMLType Samples
      6. Setting Up a WebDAV Folder
      7. What Is the Oracle XML Database?
      8. XMLType
      9. XMLType Views
      10. SQL/XML Processing
      11. Oracle XML DB Repository
      12. Oracle Text
      13. Oracle Advanced Queuing
      14. XML Database and Standards
      15. Designing the XML Database
      16. How to Store XML Data
      17. How to Retrieve and Generate XML
      18. How to Search XML Data
      19. How to Design XML Database for Web Applications
      20. How to Design XML Database for Messaging Application
      21. Summary
    2. 9 Storing XML Data
      1. Storing XML Documents in CLOB XMLTypes
      2. Updating and Querying CLOB XMLTypes
      3. Dealing with Character Encoding for CLOB XMLTypes
      4. Storing XML Documents in XML Schema–based XMLTypes
      5. XML Schema Registration
      6. XML Schema Annotations
      7. XML Data Loading
      8. XML Schema Validation
      9. Oracle XML DB Repository
      10. Storing XML Documents in Relational Tables
      11. XML SQL Utility
      12. TransX Utility
      13. DBMS_XMLSTORE
      14. Using External Tables
      15. Schema Evolution
      16. Best Practices
      17. Handling Document Type Definitions
      18. Creating XML Schema–based XMLTypes
      19. Specifying Namespaces
      20. Summary
    3. 10 Generating and Retrieving XML
      1. Generating XML from SQL Data with SQL XML Functions
      2. XMLELEMENT() and XMLATTRIBUTES()
      3. SYS_XMLGEN()
      4. XMLFOREST()
      5. XMLSEQUENCE()
      6. XMLCONCAT()
      7. XMLAGG()
      8. SYS_XMLAGG()
      9. XMLCOLATTVAL()
      10. UPDATEXML()
      11. Generating XML from SQL Data with DBM XMLGEN
      12. Canonical Mapping
      13. Print Formatting
      14. Data Fetching
      15. Using REF Cursor
      16. Using Bind Variables
      17. Dealing with Special Characters
      18. Retrieving Using XMLType and SQL/XML Functions
      19. extract() and existsNode()
      20. EXTRACTVALUE()
      21. Generating XML Schemas
      22. Creating XMLType Views
      23. Processing XML
      24. Dealing with XML Fragments
      25. DOM Editing
      26. Best Practices
      27. Summary
    4. 11 Searching XML Data
      1. XPath-Based Searches
      2. Searching the XML Document Using XPath
      3. How XPath-Based Searching Works
      4. Optimizing XPath-Based Queries Using Indexes
      5. Full Text Search
      6. Searching XML Using Oracle Text
      7. How Oracle Text Search Works
      8. Optimizing Oracle Text Searches
      9. Advanced Text Searches
      10. Best Practices
      11. When to Use XPath-Based Searches
      12. When to Use Oracle Text Searches
      13. When to Use Oracle Text Partitioned Indexes
      14. Summary
    5. 12 Managing the Oracle XML Database
      1. Installed Oracle XML DB Components
      2. Configuring the Oracle XML DB
      3. Understanding xdbconfig.xml
      4. Configuring xdbconfig.xml
      5. Security Management
      6. Protecting Data in the Oracle XML DB Repository
      7. Securing DBUri Operations
      8. Summary
  8. Part III Oracle XML for Java Developers
    1. 13 Getting Started with Oracle XML and Java
      1. The Oracle XDK Java Libraries
      2. xmlparserv2.jar
      3. xml.jar
      4. xschema.jar
      5. oraclexsql.jar and xsqlserializers.jar
      6. xmlcomp.jar, xmlcomp2.jar, xmldemo.jar, and jdev-rt.zip
      7. xsu12.jar
      8. classgen.jar
      9. xdb.jar
      10. xmlmesg.jar
      11. transx.zip
      12. orai18n.jar
      13. classes12.jar and ojdbc14.jar
      14. The JDK Environment
      15. Setting Up the JDK Environment
      16. Using the XDK with Oracle JDeveloper
      17. Setting Up an XDK Environment
      18. Setting Up a Database Connection
      19. Creating an XDK Component Palette
      20. Summary
    2. 14 Building an XML-Powered Web Site
      1. An XML-Enabled FAQ Web Site
      2. Designing the Framework
      3. Creating the FAQ Database
      4. Designing the FAQ Schema
      5. Creating a Database User
      6. Registering the FAQ Schema
      7. Loading the FAQs
      8. Connecting the FAQ Web Site to the XML Database
      9. Building the XSQL Home Page
      10. Creating the FAQ List
      11. Filtering the FAQ List
      12. Adding Pagination to the FAQ Listing
      13. Displaying the FAQ and Answers
      14. Creating a Glossary
      15. Creating the Glossary Schema
      16. Loading the Glossary
      17. Linking to the Glossary
      18. Displaying the Glossary Definitions
      19. Searching the FAQs
      20. Summary
    3. 15 Creating a Portal Site with XML and Web Services
      1. Designing the Framework
      2. Designing the Static and Dynamic Areas
      3. Creating the Dynamic Areas
      4. Creating the Static Areas
      5. Adding the Portal Functionality
      6. Creating the User Schema
      7. Creating the Login Area
      8. Creating the User Application Form
      9. Creating an Administration Page
      10. Summary
    4. 16 Developing an XML Gateway Application with SOAP and AQ
      1. Designing the Framework
      2. A Conventional Solution
      3. A Stream-Based One-Step Solution
      4. Interfacing to the Internet
      5. Creating the Framework
      6. Creating the Database Schema
      7. Creating the XML Purchase Orders
      8. Creating the XML Messaging Gateway
      9. Creating the Messaging Schema
      10. Creating the AQ Agent and Queue
      11. Creating the AQ PO Process Procedures
      12. Extending the Framework
      13. Extending the Application’s Functionality
      14. Submitting SOAP Messages
      15. Handling of xsi:types in POs
      16. Generating an E-Mail Confirmation
      17. Summary
    5. 17 Developing XML-Based Reusable Components
      1. Designing the Framework
      2. Simple Pipeline Examples
      3. SAX Parsing and Printing
      4. Parsing and Checking for Differences
      5. Building the Pipeline Application
      6. The XSDSchemaBuilder Process
      7. The XSDValProcess Process
      8. The XSDConditionalValProcess Process
      9. Running the Pipeline Application
      10. Processing an Invalid Document
      11. Processing a Document That Is Valid Against the Remote Schema
      12. Processing an Invalid XML Document with Consistent Local and Remote XSDs
      13. Processing an Invalid Document Against Both Schemas with Change
      14. Summary
  9. Part IV Oracle XML for C Developers
    1. 18 Getting Started with Oracle XML and C
      1. The Oracle XDK C Libraries
      2. libxml10.a, libxml10.so, and oraxml10.dll
      3. libcore10.a, libcoresh10.so, and libcore10.dll
      4. libnls10.a and oranls10.dll
      5. libunls10.a and oraunls10.dll
      6. Setting Up Your C XML Development Environment
      7. UNIX Setup of XDK C Components
      8. Checking Your C Run-Time Environment
      9. Setting Up Your C Compile-Time Environment
      10. Windows Setup of XDK C Components
      11. Checking Your C Run-Time Environment
      12. Setting Up Your C Compile-Time Environment
      13. Confirming Your C Compile-Time Environment
      14. Setting Up Microsoft Visual C/C++
      15. Summary
    2. 19 Building an XML-Managed Application
      1. Designing the Framework
      2. The XML Media Files
      3. Creating an XML Configuration File
      4. Defining the XSLT Stylesheets
      5. Defining the Profiles
      6. Creating the XSL Stylesheets
      7. Creating the publishcat Application
      8. Summary
    3. 20 Build an XML Database OCI Application
      1. Designing the Framework
      2. Setting Up the OCI Application Environment
      3. The OCI XML Application Headers
      4. The OCI XML Application Libraries
      5. The OCI XML Application Make Files
      6. The Update Application
      7. Initializing the OCI Application
      8. Retrieving a DOM of the Record List via OCI
      9. Performing Unified DOM Operations
      10. Running the xmlupdate Application
      11. Summary
    4. 21 Create an XML-Configured High-Performance Transformation Engine
      1. Designing the Framework
      2. Compiling Stylesheets with xslcompile
      3. Running the XSLT Virtual Machine with xsbtransform
      4. Summary
  10. Part V Oracle XML for C++ Developers
    1. 22 Getting Started with Oracle XML and C++
      1. The Oracle XDK C++ Libraries
      2. libxml10.a, libxml10.so, and libxml10.dl
      3. libcore10.a, libcoresh10.so, and libcore10.dll
      4. libnls10.a and oranls10.dll
      5. libunls10.a and oraunls10.dll
      6. Setting Up Your C++ XML Development Environment
      7. UNIX Setup of XDK C++ Components
      8. Checking Your C++ Run-Time Environment
      9. Windows Setup of XDK C++ Components
      10. Checking Your C++ Run-Time Environment
      11. Setting Up Your C++ Compile-Time Environment
      12. Setting Up Microsoft Visual C/C++
      13. Summary
    2. 23 Build an XML Database OCI C++ Application
      1. Designing the Framework
      2. Setting Up the C++ OCI XML Application Environment
      3. The OCI XML Application Headers
      4. The OCI and C++ XML Application Libraries
      5. Creating the C++ OCI Helper Class
      6. Initializing the C++ Database XML Application
      7. Handling OCI Errors
      8. Connecting to the Database
      9. Disconnecting from the Database and Cleaning Up
      10. Creating the C++ Query Application
      11. Selecting into an XMLType
      12. Initializing the XDK for XMLType XOB Access
      13. Querying an XMLType with the C++ XDK APIs
      14. Running the Application
      15. Summary
    3. 24 Building an XML Data-Retrieval Application
      1. Designing the Framework
      2. Building the cppextract Application
      3. Creating the Generic Functions
      4. Instantiating the Generic Functions with cppextractForce
      5. Creating the Main Program with cppextractMain
      6. Running the cppextract Application
      7. Running cppextract in Extraction Mode
      8. Running cppextract in Splitter Mode
      9. Extending the Framework
      10. An XML Document Pruning Use Case for cppextract
      11. A Content-Management Use Case for cppextract
      12. Summary
  11. Part VI Oracle XML for PL/SQL Developers
    1. 25 Getting Started with Oracle XML and PL/SQL
      1. Setting Up the Environment
      2. PL/SQL XML Processing Techniques
      3. Parsing XML
      4. Processing XML Using DOM
      5. Processing XML Using XSLT
      6. Setting Up Oracle JVM
      7. Summary
    2. 26 Building PL/SQL Web Services
      1. Building and Publishing the First Database Web Service
      2. Setting Up the Database Schema
      3. Publishing the PL/SQL Web Service Using Oracle JDeveloper 10g
      4. Calling the Web Service from Clients
      5. Debugging the Web Service
      6. Consuming a Web Service Within the Oracle Database
      7. Constructing SOAP Messages
      8. Sending Out SOAP Messages Using UTL_HTTP
      9. Extending the Application
      10. When to Build Web Services in the Database Server
      11. Setting Up the Security Protection
      12. Building Different Types of Web Services
      13. Summary
    3. 27 Extending PL/SQL XML Functionality with Java
      1. Creating the Java Stored Procedure to Process XML
      2. Implementing the Java Code
      3. Deploying the Java Code to the Oracle JVM
      4. Creating the PL/SQL Specification
      5. Running the Java Stored Procedure
      6. Simplifying Deployment of Java Stored Procedures Using Oracle JDeveloper 10g
      7. Processing XML in the Oracle JVM
      8. Resolving URL References
      9. SAX XML Processing
      10. Developing Your Own Java Stored Procedures
      11. When to Use Java Stored Procedures
      12. How to Debug Java Stored Procedures
      13. Summary
    4. 28 Putting It All Together
      1. The Oracle XML Platform
      2. XML Processing Tier Decisions
      3. Database Design Decisions for XML
      4. XMLType CLOB
      5. XMLType Views
      6. XML Stored in the Oracle XML DB Repository
      7. Java, C, C++, and PL/SQL Decisions
      8. Extending the Oracle XML Platform
  12. A XML Standards Bodies and Open Specifications
    1. Introducing the W3C Specifications
    2. W3C XML Specification
    3. W3C DOM Specification
    4. SAX Specification
    5. W3C Namespace Specifications
    6. W3C XML Schema Specification
    7. W3C XML Query Specification
    8. W3C XSLT and XPath Specification
    9. W3C XML Pipeline Definition Language Specification
    10. W3C XML Protocol
    11. Java Community Process Specifications
    12. Sun JAXB Specification
    13. Sun JAXP Specification
    14. Sun StAX Specification
    15. ISO SQL/XML Specification
    16. Oracle Technical Resources
    17. Other Helpful Resources
  13. Glossary
  14. Index
  15. International Contact Information