Tải bản đầy đủ (.pdf) (840 trang)

Tài liệu Oracle XML DB Developer''''s Guide pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (12.42 MB, 840 trang )

Oracle® XML DB
Developer's Guide
10g Release 1 (10.1)
Part No. B10790-01
December 2003
This manual describes Oracle XML DB components and
related tools, such as SQL*Loader and Oracle Enterprise
Manager, and how to use them with Oracle XML DB. It
includes guidelines and examples for managing, loading,
storing, processing, accessing, generating, and searching
XML data stored in Oracle Database.
Oracle XML DB Developer's Guide, 10g Release 1 (10.1)
Part No. B10790-01
Copyright © 2002, 2003, Oracle. All rights reserved.
Primary Author: Shelley Higgins
Contributing Author: Drew Adams, Nipun Agarwal, Abhay Agrawal, Omar Alonso, David Anniss,
Sandeepan Banerjee, Mark Bauer, Ravinder Booreddy, Stephen Buxton, Yuen Chan, Sivasankaran
Chandrasekar, Vincent Chao, Ravindranath Chennoju, Dan Chiba, Mark Drake, Fei Ge, Wenyun He, Thuvan
Hoang, Sam Idicula, Namit Jain, Neema Jalali, Bhushan Khaladkar, Viswanathan Krishnamurthy,
Muralidhar Krishnaprasad, Geoff Lee, Wesley Lin, Annie Liu, Anand Manikutty, Jack Melnick, Nicolas
Montoya, Steve Muench, Ravi Murthy, Eric Paapanen, Syam Pannala, John Russell, Eric Sedlar, Vipul Shah,
Cathy Shea, Asha Tarachandani, Tarvinder Singh, Simon Slack, Muralidhar Subramanian, Asha
Tarachandani, Priya Vennapusa, James Warner
Contributor: Reema Al-Shaikh, Harish Akali, Vikas Arora, Deanna Bradshaw, Paul Brandenstein, Lisa
Eldridge, Craig Foch, Wei Hu, Reema Koo, Susan Kotsovolos, Sonia Kumar, Roza Leyderman, Zhen Hua
Liu, Diana Lorentz, Yasuhiro Matsuda, Valarie Moore, Bhagat Nainani, Visar Nimani, Sunitha Patel, Denis
Raphaely, Rebecca Reitmeyer, Ronen Wolf
The Programs (which include both the software and documentation) contain proprietary information; they
are provided under a license agreement containing restrictions on use and disclosure and are also protected
by copyright, patent, and other intellectual and industrial property laws. Reverse engineering, disassembly,
or decompilation of the Programs, except to the extent required to obtain interoperability with other


independently created software or as specified by law, is prohibited.
The information contained in this document is subject to change without notice. If you find any problems in
the documentation, please report them to us in writing. This document is not warranted to be error-free.
Except as may be expressly permitted in your license agreement for these Programs, no part of these
Programs may be reproduced or transmitted in any form or by any means, electronic or mechanical, for any
purpose.
If the Programs are delivered to the United States Government or anyone licensing or using the Programs on
behalf of the United States Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data
delivered to U.S. Government customers are "commercial computer software" or "commercial technical data"
pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As
such, use, duplication, disclosure, modification, and adaptation of the Programs, including documentation
and technical data, shall be subject to the licensing restrictions set forth in the applicable Oracle license
agreement, and, to the extent applicable, the additional rights set forth in FAR 52.227-19, Commercial
Computer Software Restricted Rights (June 1987). Oracle Corporation, 500 Oracle Parkway, Redwood City,
CA 94065
The Programs are not intended for use in any nuclear, aviation, mass transit, medical, or other inherently
dangerous applications. It shall be the licensee's responsibility to take all appropriate fail-safe, backup,
redundancy and other measures to ensure the safe use of such applications if the Programs are used for such
purposes, and we disclaim liability for any damages caused by such use of the Programs.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks
of their respective owners.
The Programs may provide links to Web sites and access to content, products, and services from third
parties. Oracle is not responsible for the availability of, or any content provided on, third-party Web sites.
You bear all risks associated with the use of such content. If you choose to purchase any products or services
from a third party, the relationship is directly between you and the third party. Oracle is not responsible for:
(a) the quality of third-party products or services; or (b) fulfilling any of the terms of the agreement with the
third party, including delivery of products or services and warranty obligations related to purchased
products or services. Oracle is not responsible for any loss or damage of any sort that you may incur from
dealing with any third party.

iii
Contents
Send Us Your Comments xxvii
Preface xxix
Intended Audience xxix
Documentation Accessibility xxix
Structure xxx
Related Documents xxxiv
Conventions xxxv
What's New In Oracle XML DB? xxxix
Oracle XML DB: Oracle Database 10g Release 1 (10.1), Enhancements xxxix
Oracle Text Enhancements xl
Oracle Streams Advanced Queuing (AQ) Support xl
Oracle XDK Support for XMLType xli
Part I Introducing Oracle XML DB
1 Introducing Oracle XML DB
Introducing Oracle XML DB 1-1
Oracle XML DB Architecture 1-2
XMLType Storage 1-3
Oracle XML DB Repository 1-4
APIs for Accessing and Manipulating XML 1-4
XML Services 1-5
XML Repository Architecture 1-6
How Does Oracle XML DB Repository Work? 1-7
Oracle XML DB Protocol Architecture 1-8
Programmatic Access to Oracle XML DB (Java, PL/SQL, and C) 1-9
Oracle XML DB Features 1-9
XMLType 1-10
XML Schema 1-11
Structured Versus Unstructured Storage 1-13

XML / SQL Duality 1-14
SQL/XML ICITS Standard Operators 1-15
XPath and XQuery Rewrite 1-16
iv
Oracle XML DB Benefits 1-17
Unifying Data and Content with Oracle XML DB 1-18
Exploiting Database Capabilities 1-19
Exploiting XML Capabilities 1-20
Oracle XML DB Offers Faster Storage and Retrieval of Complex XML Documents 1-21
Oracle XML DB Helps You Integrate Applications 1-21
When Your Data Is Not XML You Can Use XMLType Views 1-21
Searching XML Data Stored in CLOBs Using Oracle Text 1-22
Building Messaging Applications using Oracle Streams Advanced Queuing 1-22
Managing Oracle XML DB Applications with Oracle Enterprise Manager 1-23
Requirements for Running Oracle XML DB 1-23
Standards Supported by Oracle XML DB 1-23
Oracle XML DB Technical Support 1-24
Oracle XML DB Examples Used in This Manual 1-24
Further Oracle XML DB Case Studies and Demonstrations 1-24
2 Getting Started with Oracle XML DB
Installing Oracle XML DB 2-1
When to Use Oracle XML DB 2-1
Designing Your XML Application 2-2
Oracle XML DB Design Issues: Introduction 2-2
a. Data 2-2
b. Access 2-2
c. Application Language 2-3
d. Processing 2-3
e. Storage 2-3
Oracle XML DB Application Design: a. How Structured Is Your Data? 2-4

XML Schema-Based or Non-Schema-Based 2-4
Oracle XML DB Application Design: b. Access Models 2-5
Oracle XML DB Application Design: c. Application Language 2-6
Oracle XML DB Application Design: d. Processing Models 2-7
Messaging Options 2-7
Oracle XML DB Design: e. Storage Models 2-8
Using XMLType Tables 2-8
Using XMLType Views 2-9
Oracle XML DB Performance 2-9
XML Storage Requirements 2-10
XML Memory Management 2-10
XML Parsing Optimizations 2-11
Node-Searching Optimizations 2-11
XML Schema Optimizations 2-11
Load Balancing Through Cached XML Schema 2-12
Reduced Non-Native Code Bottlenecks 2-12
Reduced Java Type Conversion Bottlenecks 2-12
3 Using Oracle XML DB
Storing XML as XMLType 3-2
v
What is XMLType 3-2
Benefits of the XMLType Datatype and API 3-3
When to Use XMLType 3-3
There are Two Main Ways to Store XMLType Data: LOBs and Structured 3-4
Advantages and Disadvantages of XML Storage Options in Oracle XML DB 3-4
When to Use CLOB Storage for XMLType 3-4
Creating XMLType Tables and Columns 3-4
Loading XML Content Into Oracle XML DB 3-5
Loading XML Content into Oracle XML DB Using SQL or PL/SQL 3-5
Loading XML Content into Oracle XML DB Using Java 3-7

Loading XML Content into Oracle XML DB Using C 3-7
Loading Very Large XML Files of Smaller XML Documents into Oracle Database 3-12
Loading Large XML Files into Oracle Database Using SQL*Loader 3-12
Loading XML Documents into Oracle XML DB Repository 3-13
Loading Documents into Oracle XML DB Repository Using Protocols 3-13
Handling Non-ASCII XML Documents 3-14
XML Encoding Declaration 3-14
Loading Non-ASCII XML Documents 3-15
Retrieving Non-ASCII XML Documents 3-15
APIs Introduced in 10g Release 1 for Handling Non-ASCII Documents 3-16
Introducing the W3C XML Schema Recommendation 3-16
XML Instance Documents 3-16
The Schema for Schemas 3-17
Editing XML Schemas 3-17
XML Schema Features 3-17
Text Representation of the PurchaseOrder XML Schema 3-17
Graphical Representation of the PurchaseOrder XML Schema 3-20
XML Schema and Oracle XML DB 3-21
Why Use XML Schema With Oracle XML DB? 3-21
Validating Instance Documents with XML Schema 3-22
Constraining Instance Documents for Business Rules or Format Compliance 3-22
Defining How XMLType Contents Must be Stored in the Database 3-22
Structured Storage of XML Documents 3-22
Annotating an XML Schema to Control Naming, Mapping, and Storage 3-23
Controlling How XML Collections are Stored in the Database 3-23
Collections: Default Mapping 3-23
Declaring the Oracle XML DB Namespace 3-23
Registering an XML Schema with Oracle XML DB 3-28
SQL Types and Tables Created During XML Schema Registration 3-29
Working with Large XML Schemas 3-30

Working with Global Elements 3-31
Creating XML Schema-Based XMLType Columns and Tables 3-31
Default Tables 3-32
Identifying Instance Documents 3-33
noNamespaceSchemaLocation Attribute 3-33
schemaLocation Attribute 3-34
Dealing with Multiple Namespaces 3-34
vi
Using the Database to Enforce XML Data Integrity 3-34
Comparing Partial to Full XML Schema Validation 3-35
Partial Validation 3-35
Full Validation 3-36
Full XML Schema Validation Costs CPU and Memory Usage 3-36
Using SQL Constraints to Enforce Referential Integrity 3-38
DML Operations on XML Content Using Oracle XML DB 3-42
XPath and Oracle XML 3-42
Querying XML Content Stored in Oracle XML DB 3-42
A PurchaseOrder XML Document 3-42
Retrieving the Content of an XML Document Using Object_Value 3-43
Accessing Fragments or Nodes of an XML Document Using extract() 3-44
Accessing Text Nodes and Attribute Values Using extractValue() 3-45
Invalid Use of extractValue() 3-46
Searching the Content of an XML Document Using existsNode() 3-47
Using extractValue() and existsNode() in the WHERE Clause 3-49
Using XMLSequence() to Perform SQL Operations on XMLType Fragments 3-50
Accessing and Updating XML Content in Oracle XML DB Repository 3-53
Relational Access to XML Content Stored in Oracle XML DB Using Views 3-55
Updating XML Content Stored in Oracle XML DB 3-58
Updating XML Schema-Based and Non-Schema-Based XML Documents 3-63
Namespace Support in Oracle XML DB 3-63

Processing XMLType Methods and XML-Specific SQL Functions 3-64
Understanding and Optimizing XPath Rewrite 3-64
Using the EXPLAIN Plan to Tune XPath Rewrites 3-65
Using Indexes to Tune Simple XPath-Based Operations 3-65
Using Indexes to Improve Performance of XPath-Based Functions 3-66
Optimizing Operations on Collections 3-67
Using Indexes to Tune Queries on Collections Stored as Nested Tables 3-67
EXPLAIN Plan Output with ACL-Based Security Enabled: SYS_CHECKACL() Filter 3-69
Accessing Relational Database Content Using XML 3-70
Generating XML From Relational Tables Using DBUriType 3-78
XSL Transformation 3-80
Using XSLT with Oracle XML DB 3-80
Using Oracle XML DB Repository 3-88
Installing and Uninstalling Oracle XML DB Repository 3-89
Oracle XML DB Provides Name-Level Not Folder-Level Locking 3-89
Use Protocols or SQL to Access and Process Repository Content 3-90
Using Standard Protocols to Store and Retrieve Content 3-90
Uploading Content Into Oracle XML DB Using FTP 3-91
Accessing Oracle XML DB Repository Programmatically 3-93
Accessing the Content of Documents Using SQL 3-93
Accessing the Content of XML Schema-Based Documents 3-95
Using the XMLRef Element in Joins to Access Resource Content in the Repository 3-95
Updating the Content of Documents Stored in Oracle XML DB Repository 3-97
Updating Repository Content Using Protocols 3-97
Updating Repository Content Using SQL 3-98
vii
Updating XML Schema-Based Documents in the Repository 3-99
Controlling Access to Repository Data 3-99
XML DB Transactional Semantics 3-100
Querying Metadata and the Folder Hierarchy 3-100

Querying Resources Stored in RESOURCE_VIEW and PATH_VIEW 3-102
The Oracle XML DB Hierarchical Index 3-104
How Documents are Stored in Oracle XML DB Repository 3-105
Viewing Relational Data as XML From a Browser 3-106
Using DBUri Servlet to Access Any Table or View From a Browser 3-106
XSL Transformation Using DBUri Servlet 3-108
Part II Storing and Retrieving XML Data in Oracle XML DB
4 XMLType Operations
Manipulating XML Data With SQL Member Functions 4-1
Selecting and Querying XML Data 4-1
Searching XML Documents With XPath Expressions 4-2
Oracle Extension XPath Function Support 4-2
Selecting XML Data Using XMLType Member Functions 4-2
Querying XML Data Using XMLType Functions 4-4
existsNode() XMLType Function 4-5
Using Indexes to Evaluate existsNode() 4-6
extract() XMLType Function 4-6
extractValue() XMLType Function 4-9
A Shortcut Function 4-9
extractValue() Characteristics 4-9
Querying XML Data With SQL 4-10
Updating XML Instances and XML Data in Tables 4-17
updateXML() XMLType Function 4-18
updateXML() and NULL Values 4-22
Updating the Same XML Node More Than Once 4-24
Guidelines For Preserving DOM Fidelity When Using updateXML() 4-24
When DOM Fidelity is Preserved 4-24
When DOM Fidelity is Not Preserved 4-24
Optimization of updateXML() 4-24
Creating Views of XML Data with updateXML() 4-26

Indexing XMLType Columns 4-26
XPATH REWRITE for indexes on Singleton Elements or Attributes 4-27
Creating B-Tree Indexes on the Contents of a Collection 4-27
Creating Function-Based Indexes on XMLType Tables and Columns 4-29
CTXXPath Indexes on XMLType Columns 4-32
CTXXPATH Indexing Features 4-32
Creating CTXXPATH Indexes 4-33
Creating CTXXPATH Storage Preferences With CTX_DDL. Statements 4-33
Performance Tuning a CTXXPATH Index: Synchronizing and Optimizing 4-34
Choosing the Right Plan: Using CTXXPATH Index in existsNode() Processing 4-35
viii
CTXXPATH Indexes On XML Schema-Based XMLType Tables 4-35
Determining If an Index is Being Used: Tracing 4-37
CTXXPATH Indexing Depends on Storage Options and Document Size 4-37
Oracle Text Indexes on XMLType Columns 4-38
5 XML Schema Storage and Query: The Basics
Introducing XML Schema 5-1
XML Schema and Oracle XML DB 5-2
Using Oracle XML DB and XML Schema 5-7
Why We Need XML Schema 5-8
XML Schema Provides Flexible XML-to-SQL Mapping Setup 5-8
XML Schema Allows XML Instance Validation 5-8
DTD Support in Oracle XML DB 5-9
Inline DTD Definitions 5-9
External DTD Definitions 5-9
Managing XML Schemas Using DBMS_XMLSCHEMA 5-9
Registering Your XML Schema 5-9
Storage and Access Infrastructure 5-10
Transactional Action of XML Schema Registration 5-10
Managing and Storing XML Schema 5-11

Debugging XML Schema Registration 5-11
SQL Object Types 5-11
Creating Default Tables During XML Schema Registration 5-12
Generated Names are Case Sensitive 5-13
Objects That Depend on Registered XML Schemas 5-13
How to Obtain a List of Registered XML Schemas 5-13
Deleting Your XML Schema Using DBMS_XMLSCHEMA 5-14
FORCE Mode 5-14
XML Schema-Related Methods of XMLType 5-15
Local and Global XML Schemas 5-15
Local XML Schema 5-15
Global XML Schema 5-16
DOM Fidelity 5-17
How Oracle XML DB Ensures DOM Fidelity with XML Schema 5-17
DOM Fidelity and SYS_XDBPD$ 5-18
Creating XMLType Tables and Columns Based on XML Schema 5-18
Specifying Unstructured (LOB-Based) Storage of Schema-Based XMLType 5-19
Specifying Storage Models for Structured Storage of Schema-Based XMLType 5-20
Specifying Relational Constraints on XMLType Tables and Columns 5-21
Oracle XML Schema Annotations 5-21
Querying a Registered XML Schema to Obtain Annotations 5-27
SQL Mapping Is Specified in the XML Schema During Registration 5-28
Mapping of Types Using DBMS_XMLSCHEMA 5-30
Setting Attribute Mapping Type Information 5-30
Overriding the SQLType Value in XML Schema When Declaring Attributes 5-31
Setting Element Mapping Type Information 5-31
Overriding the SQLType Value in XML Schema When Declaring Elements 5-31
ix
Mapping simpleTypes to SQL 5-32
simpleType: Mapping XML Strings to SQL VARCHAR2 Versus CLOBs 5-34

Working with Time Zones 5-35
Mapping complexTypes to SQL 5-35
Specifying Attributes in a complexType XML Schema Declaration 5-36
XPath Rewrite with XML Schema-Based Structured Storage 5-37
What Is XPath Rewrite? 5-37
When Does XPath Rewrite Occur? 5-38
What XPath Expressions Are Rewritten? 5-38
Common XPath Constructs Supported in XPath Rewrite 5-40
Unsupported XPath Constructs in XPath Rewrite 5-40
Common XMLSchema constructs supported in XPath Rewrite 5-41
Unsupported XML Schema Constructs in XPath Rewrite 5-41
Common storage constructs supported in XPath Rewrite 5-41
Unsupported Storage Constructs in XPath Rewrite 5-41
Is there a difference in XPath logic with rewrite? 5-42
How are the XPaths Rewritten? 5-42
Rewriting XPath Expressions: Mapping Types and Path Expressions 5-44
Rewrite of SQL Functions 5-48
XPath Expression Rewrites for ExistsNode 5-48
Rewrite for extractValue 5-50
Rewrite of XMLSequence Function 5-52
Rewrite for extract() 5-53
Optimizing updates using updateXML() 5-55
Diagnosing XPath Rewrite 5-56
Using Explain Plans 5-56
Using Events 5-57
Turning off Functional Evaluation (Event 19021) 5-57
Tracing reasons for non-rewrite 5-58
6 XML Schema Storage and Query: Advanced Topics
Generating XML Schema Using DBMS_XMLSCHEMA.generateSchema() 6-1
Adding Unique Constraints to An Attribute's Elements 6-3

Setting the SQLInLine Attribute to FALSE for Out-of-Line Storage 6-4
Query Rewrite For Out-Of-Line Tables 6-6
Storing Collections in Out-Of-Line Tables 6-7
Intermediate table for storing the list of references 6-9
Fully Qualified XML Schema URLs 6-11
Fully Qualified XML Schema URLs Permit Explicit Reference to XML Schema URLs 6-11
Mapping XML Fragments to Large Objects (LOBs) 6-11
Oracle XML DB complexType Extensions and Restrictions 6-12
complexType Declarations in XML Schema: Handling Inheritance 6-13
Mapping complexType: simpleContent to Object Types 6-15
Mapping complexType: Any and AnyAttributes 6-15
Inserting New Instances into XMLType Columns 6-16
Examining Type Information in Oracle XML DB 6-16
ora:instanceof() and ora:instanceof-only() 6-16
x
Working With Circular and Cyclical Dependencies 6-18
For Circular Dependency Set GenTables Parameter to TRUE 6-18
Handling Cycling Between complexTypes in XML Schema 6-19
How a complexType Can Reference Itself 6-20
Oracle XML DB: XPath Expression Rewrites for existsNode() 6-21
existsNode Mapping with Document Order Maintained 6-21
existsNode Mapping Without Maintaining Document Order 6-23
Oracle XML DB: Rewrite for extractValue() 6-23
Oracle XML DB: Rewrite for extract() 6-25
Extract Mapping with Document Order Maintained 6-25
Extract Mapping Without Maintaining Document Order 6-26
Optimizing Updates Using updateXML() 6-26
Cyclical References Between XML Schemas 6-27
Guidelines for Using XML Schema and Oracle XML DB 6-29
Using Bind Variables in XPath Expressions 6-29

Creating Constraints on Repetitive Elements in Schema-Based XML Instance Documents . 6-31
Guidelines for Loading and Retrieving Large Documents with Collections 6-32
Guidelines for Setting xdbcore Parameters 6-34
Updating Your XML Schema Using Schema Evolution 6-34
7 XML Schema Evolution
Introducing XML Schema Evolution 7-1
Limitations of CopyEvolve() 7-1
Example XML Schema 7-2
Guidelines for Using DBMS_XMLSCHEMA.CopyEvolve() 7-3
Top-Level Element Name Changes 7-3
Ensure that the XML Schema and Dependents are Not Used by Concurrent Sessions 7-4
What Happens When CopyEvolve() Raises an Error? Rollback 7-4
Failed Rollback From Insufficient Privileges 7-4
Using CopyEvolve(): Privileges Needed 7-4
DBMS_XMLSCHEMA.CopyEvolve() Syntax 7-5
How DBMS_XMLSCHEMA.CopyEvolve() Works 7-7
8 Transforming and Validating XMLType Data
Transforming XMLType Instances 8-1
XMLTransform() and XMLType.transform() 8-2
XMLTransform() Examples 8-2
Validating XMLType Instances 8-6
XMLIsValid() 8-7
schemaValidate 8-7
isSchemaValidated() 8-7
setSchemaValidated() 8-7
isSchemaValid() 8-8
Validating XML Data Stored as XMLType: Examples 8-8
xi
9 Full Text Search Over XML
Full Text Search and XML 9-1

Comparison of Full Text Search and Other Search Types 9-2
XML search 9-2
Search using Full Text and XML Structure 9-2
About the Examples in this Chapter 9-2
Roles and Privileges 9-2
Examples Schema and Data 9-3
Overview of CONTAINS and ora:contains 9-3
Overview of the CONTAINS SQL Function 9-3
Overview of the ora:contains XPath Function 9-4
Comparison of CONTAINS and ora:contains 9-5
CONTAINS SQL Function 9-5
Full Text Search 9-5
Boolean Operators: AND, OR, NOT 9-6
Stemming: $ 9-6
Combining Boolean and Stemming Operators 9-7
Score 9-7
Structure: Restricting the Scope of the Search 9-8
WITHIN 9-8
Nested WITHIN 9-8
WITHIN Attributes 9-8
WITHIN and AND 9-9
Definition of Section 9-10
INPATH 9-10
The Text Path 9-10
Text Path Compared to XPath 9-11
Nested INPATH 9-12
HASPATH 9-12
Structure: Projecting the Result 9-13
Indexing 9-14
Introduction to the CONTEXT Index 9-14

CONTEXT Index on XMLType Table 9-15
Maintaining the CONTEXT Index 9-15
Roles and Privileges 9-16
Effect of the CONTEXT Index on CONTAINS 9-16
The CONTEXT Index: Preferences 9-16
Making Search Case-Sensitive 9-16
Introduction to Section Groups 9-17
Choosing a Section Group Type 9-17
Choosing a Section Group 9-18
ora:contains XPath Function 9-19
Full Text Search 9-19
Score 9-20
Structure: Restricting the Scope of the Query 9-20
Structure: Projecting the Result 9-20
Policies 9-21
xii
Introduction to Policies 9-21
Policy Example: Supplied Stoplist 9-21
Effect of Policies on ora:contains 9-22
Policy Example: User-Defined Lexer 9-22
Policy Defaults 9-24
ora:contains Performance 9-25
Use a Primary Filter in the Query 9-25
Use a CTXXPath Index 9-26
When to Use CTXXPATH 9-27
Maintaining the CTXXPATH Index 9-28
Query-Rewrite and the CONTEXT Index 9-28
Introducing Query-Rewrite 9-28
From Documents to Nodes 9-29
From ora:contains to CONTAINS 9-29

Query-Rewrite: Summary 9-30
Text Path BNF 9-30
Example Support 9-31
Purchase Order po001.xml 9-31
Create Table Statements 9-32
An XML Schema for the Sample Data 9-34
Part III Using APIs for XMLType to Access and Operate on XML
10 PL/SQL API for XMLType
Introducing PL/SQL APIs for XMLType 10-1
PL/SQL APIs For XMLType Features 10-1
Lazy XML Loading (Lazy Manifestation) 10-2
XMLType Datatype Now Supports XML Schema 10-2
XMLType Supports Data in Different Character Sets. 10-2
With PL/SQL APIs for XMLType You Can Modify and Store XML Elements 10-2
PL/SQL DOM API for XMLType (DBMS_XMLDOM) 10-3
Introducing W3C Document Object Model (DOM) Recommendation 10-3
W3C DOM Extensions Not Supported in This Release 10-3
Supported W3C DOM Recommendations 10-3
Difference Between DOM and SAX 10-4
PL/SQL DOM API for XMLType (DBMS_XMLDOM): Features 10-4
Enhanced Performance 10-5
Designing End-to-End Applications Using XDK and Oracle XML DB 10-5
Using PL/SQL DOM API for XMLType: Preparing XML Data 10-6
Generating an XML Schema Mapping to SQL Object Types 10-7
DOM Fidelity for XML Schema Mapping 10-7
Wrapping Existing Data into XML with XMLType Views 10-8
PL/SQL DOM API for XMLType (DBMS_XMLDOM) Methods 10-8
Non-Supported DBMS_XMLDOM Methods in This Release 10-8
PL/SQL DOM API for XMLType (DBMS_XMLDOM) Exceptions 10-14
PL/SQL DOM API for XMLType: Node Types 10-15

Working with Schema-Based XML Instances 10-16
xiii
DOM NodeList and NamesNodeMap Objects 10-16
PL/SQL DOM API for XMLType (DBMS_XMLDOM): Calling Sequence 10-16
PL/SQL DOM API for XMLType Examples 10-17
PL/SQL Parser API for XMLType (DBMS_XMLPARSER) 10-19
PL/SQL Parser API for XMLType: Features 10-19
PL/SQL Parser API for XMLType (DBMS_XMLPARSER): Calling Sequence 10-20
PL/SQL Parser API for XMLType Example 10-21
PL/SQL XSLT Processor for XMLType (DBMS_XSLPROCESSOR) 10-21
Enabling Transformations and Conversions with XSLT 10-21
PL/SQL XSLT Processor for XMLType: Features 10-22
PL/SQL XSLT Processor API (DBMS_XSLPROCESSOR): Methods 10-22
PL/SQL Parser API for XMLType (DBMS_XSLPROCESSOR): Calling Sequence 10-23
PL/SQL XSLT Processor for XMLType Example 10-24
11 DBMS_XMLSTORE
Overview of DBMS_XMLSTORE 11-1
Using DBMS_XMLSTORE 11-2
Insert Processing with DBMS_XMLSTORE 11-2
Update Processing with DBMS_XMLSTORE 11-3
Delete Processing with DBMS_XMLSTORE 11-4
12 Java API for XMLType
Introducing Java DOM API for XMLType 12-1
Java DOM API for XMLType 12-1
Accessing XML Documents in Repository 12-2
Accessing XML Documents Stored in Oracle Database (Java) 12-2
Using JDBC to Access XMLType Data 12-2
How Java Applications Use JDBC to Access XML Documents in Oracle XML DB 12-2
Using JDBC to Manipulate XML Documents Stored in a Database 12-4
Loading a Large XML Document into the Database With JDBC 12-12

Java DOM API for XMLType Features 12-14
Creating XML Documents Programmatically 12-14
Creating XML Schema-Based Documents 12-15
JDBC or SQLJ 12-15
Java DOM API for XMLType Classes 12-16
Java Methods Not Supported 12-17
Java DOM API for XMLType: Calling Sequence 12-17
13 Using C API for XML With Oracle XML DB
Introducing the C API for XML (XDK and Oracle XML DB) 13-1
Using OCI and the C API for XML with Oracle XML DB 13-2
XML Context 13-2
OCIXmlDbFreeXmlCtx() Syntax 13-2
OCIXmlDbInitXmlCtx() Syntax 13-2
How to Use Oracle XML DB Functions 13-3
OCI Usage 13-4
xiv
Accessing XMLType Data From the Back End 13-4
Creating XMLType Instances on the Client 13-4
Common XMLType Operations in C 13-4
14 Using ODP.NET With Oracle XML DB
Overview of Oracle Data Provider for .NET (ODP.NET) 14-1
ODP.NET XML Support 14-1
ODP.NET Sample Code 14-2
Part IV Viewing Existing Data as XML
15 Generating XML Data from the Database
Oracle XML DB Options for Generating XML Data From Oracle Database 15-1
Generating XML Using SQL/XML Functions 15-1
Generating XML Using Oracle Database Extensions to SQL/XML 15-2
Generating XML Using DBMS_XMLGEN 15-2
Generating XML Using SQL Functions 15-2

Generating XML with XSQL Pages Publishing Framework 15-2
Generating XML Using XML SQL Utility (XSU) 15-2
Generating XML from the Database Using SQL/XML Functions 15-3
XMLElement() Function 15-3
XML_Attributes_Clause 15-4
XMLForest() Function 15-8
XMLSequence() Function 15-9
XMLConcat() Function 15-13
XMLAgg() Function 15-14
XMLColAttVal() Function 15-18
Generating XML from Oracle Database Using DBMS_XMLGEN 15-19
Sample DBMS_XMLGEN Query Result 15-19
DBMS_XMLGEN Calling Sequence 15-20
Generating XML Using Oracle Database-Provided SQL Functions 15-41
SYS_XMLGEN() Function 15-41
Using XMLFormat Object Type 15-44
SYS_XMLAGG() Function 15-51
Generating XML Using XSQL Pages Publishing Framework 15-52
Generating XML Using XML SQL Utility (XSU) 15-54
Guidelines for Generating XML With Oracle XML DB 15-55
Using XMLAgg ORDER BY Clause to Order Query Results Before Aggregation 15-55
Using XMLSequence in the TABLE Clause to Return a Rowset 15-55
16 XMLType Views
What Are XMLType Views? 16-1
Creating XMLType Views: Syntax 16-2
Creating Non-Schema-Based XMLType Views 16-3
Using SQL/XML Generation Functions 16-3
Using Object Types with SYS_XMLGEN() 16-4
xv
Creating XML Schema-Based XMLType Views 16-5

Using SQL/XML Generation Functions 16-5
Step 1. Register XML Schema, emp_simple.xsd 16-5
Step 2. Create XMLType View Using SQL/XML Functions 16-6
Using Namespaces With SQL/XML Functions 16-7
Using Object Types and Views 16-10
Step 1. Create Object Types 16-11
Step 2. Create or Generate XMLSchema, emp.xsd 16-12
Step 3. Register XML Schema, emp_complex.xsd 16-12
Step 4a. Using the One-Step Process 16-13
Step 4b. Using the Two-Step Process by First Creating an Object View 16-14
Step 1. Create Object Types 16-14
Step 2. Register XML Schema, dept_complex.xsd 16-14
Step 3a. Create XMLType Views on Relational Tables 16-16
Step 3b. Create XMLType Views Using SQL/XML Functions 16-16
Creating XMLType Views From XMLType Tables 16-16
Referencing XMLType View Objects Using REF() 16-17
DML (Data Manipulation Language) on XMLType Views 16-17
XPath Rewrite on XMLType Views 16-19
XPath Rewrite on XMLType Views Constructed With SQL/XML Generation Functions 16-19
XPath Rewrite on Non-Schema-Based Views Constructed With SQL/XML 16-19
XPath Rewrite on View Constructed With SQL/XML Generation Functions 16-21
XPath Rewrite on Views Using Object Types, Object Views, and SYS_XMLGEN() 16-23
XPath Rewrite on Non-Schema-Based Views Using Object Types or Views 16-23
XPath Rewrite on XML-Schema-Based Views Using Object Types or Object Views 16-25
XPath Rewrite Event Trace 16-26
Generating XML Schema-Based XML Without Creating Views 16-26
17 Creating and Accessing Data Through URLs
How Oracle Database Works with URLs and URIs 17-1
Accessing and Processing Data Through HTTP 17-2
Creating Columns and Storing Data Using UriType 17-2

UriFactory Package 17-2
Other Sources of Information About URIs and URLs 17-3
URI Concepts 17-3
What Is a URI? 17-3
How to Create a URL Path From an XML Document View 17-4
UriType Objects Can Use Different Protocols to Retrieve Data 17-4
Advantages of Using DBUri and XDBUri 17-4
UriType Values Store Uri-References 17-5
Advantages of Using UriType Values 17-5
UriType Functions 17-5
HttpUriType Functions 17-6
getContentType() Function 17-7
getXML() Function 17-7
DBUri, Intra-Database References 17-8
Formulating the DBUri 17-8
xvi
Notation for DBUriType Fragments 17-10
DBUri Syntax Guidelines 17-10
Using Predicate (XPath) Expressions in DBUris 17-11
Some Common DBUri Scenarios 17-11
Identifying the Whole Table 17-11
Identifying a Particular Row of the Table 17-12
Identifying a Target Column 17-12
Retrieving the Text Value of a Column 17-13
How DBUris Differ from Object References 17-13
DBUri Applies to a Database and Session 17-14
Where Can DBUri Be Used? 17-14
DBUriType Functions 17-14
XDBUriType 17-16
How to Create an Instance of XDBUriType 17-16

Creating Oracle Text Indexes on UriType Columns 17-17
Using UriType Objects 17-17
Storing Pointers to Documents with UriType 17-18
Using the Substitution Mechanism 17-18
Creating Instances of UriType Objects with the UriFactory Package 17-19
Registering New UriType Subtypes with the UriFactory Package 17-19
Why Define New Subtypes of UriType? 17-21
SYS_DBURIGEN() SQL Function 17-21
Rules for Passing Columns or Object Attributes to SYS_DBURIGEN() 17-22
SYS_DBURIGEN Examples 17-23
Turning a URL into a Database Query with DBUri Servlet 17-25
DBUri Servlet Mechanism 17-25
DBUri Servlet: Optional Arguments 17-26
Installing DBUri Servlet 17-26
DBUri Security 17-27
Configuring the UriFactory Package to Handle DBUris 17-28
Part V Oracle XML DB Repository: Foldering, Security, and Protocols
18 Accessing Oracle XML DB Repository Data
Introducing Oracle XML DB Foldering 18-1
Oracle XML DB Repository 18-3
Repository Terminology 18-3
Current Repository Folder List 18-4
Oracle XML DB Resources 18-4
Where Exactly Is Repository Data Stored? 18-5
Generated Table Names 18-5
Defining Structured Storage for Resources 18-5
Path-Name Resolution 18-5
Deleting Resources 18-6
Accessing Oracle XML DB Repository Resources 18-6
Navigational or Path Access 18-7

Accessing Oracle XML DB Resources Using Internet Protocols 18-8
xvii
Where You Can Use Oracle XML DB Protocol Access 18-9
Protocol Access Calling Sequence 18-9
Retrieving Oracle XML DB Resources 18-9
Storing Oracle XML DB Resources 18-9
Using Internet Protocols and XMLType: XMLType Direct Stream Write 18-10
Configuring Default Namespace to Schema Location Mappings 18-10
Configuring XML File Extensions 18-12
Query-Based Access 18-12
Accessing Repository Data Using Servlets 18-13
Accessing Data Stored in Oracle XML DB Repository Resources 18-13
Managing and Controlling Access to Resources 18-15
Setting and Accessing Custom Namespace Properties 18-16
19 Managing Oracle XML DB Resource Versions
Introducing Oracle XML DB Versioning 19-1
Oracle XML DB Versioning Features 19-1
Oracle XML DB Versioning Terms Used in This Chapter 19-2
Oracle XML DB Resource ID and Path Name 19-2
Creating a Version-Controlled Resource (VCR) 19-3
Version Resource or VCR Version 19-3
Resource ID of a New Version 19-3
Accessing a Version-Controlled Resource (VCR) 19-5
Updating a Version-Controlled Resource (VCR) 19-5
Checkout 19-5
Checkin 19-5
Uncheckout 19-6
Update Contents and Properties 19-6
Access Control and Security of VCR 19-6
Guidelines for Using Oracle XML DB Versioning 19-8

20 SQL Access Using RESOURCE_VIEW and PATH_VIEW
Oracle XML DB RESOURCE_VIEW and PATH_VIEW 20-1
RESOURCE_VIEW Definition and Structure 20-2
PATH_VIEW Definition and Structure 20-2
Understanding the Difference Between RESOURCE_VIEW and PATH_VIEW 20-3
Operations You Can Perform Using UNDER_PATH and EQUALS_PATH 20-4
Resource_View and Path_View APIs 20-5
UNDER_PATH 20-5
EQUALS_PATH 20-6
PATH 20-6
DEPTH 20-8
Using the Resource View and Path View API 20-8
Accessing Repository Data Paths, Resources and Links: Examples 20-8
Inserting Data into a Repository Resource: Examples 20-10
Deleting Repository Resources: Examples 20-10
Deleting Non-Empty Containers Recursively 20-11
xviii
Updating Repository Resources: Examples 20-11
Working with Multiple Oracle XML DB Resources Simultaneously 20-12
Performance Tuning of XML DB 20-13
Searching for Resources Using Oracle Text 20-13
21 PL/SQL Access and Management of Data Using DBMS_XDB
Introducing Oracle XML DB Resource API for PL/SQL 21-1
Overview of DBMS_XDB 21-1
DBMS_XDB: Oracle XML DB Resource Management 21-2
Using DBMS_XDB to Manage Resources, Calling Sequence 21-3
DBMS_XDB: Oracle XML DB ACL-Based Security Management 21-5
Using DBMS_XDB to Manage Security, Calling Sequence 21-5
DBMS_XDB: Oracle XML DB Configuration Management 21-7
Using DBMS_XDB for Configuration Management, Calling Sequence 21-7

22 Java Access to Repository Data Using Resource API for Java
Introducing Oracle XML DB Resource API for Java 22-1
Using Oracle XML DB Resource API for Java 22-1
Oracle XML DB Resource API for Java Parameters 22-1
Oracle XML DB Resource API for Java: Examples 22-2
23 Oracle XML DB Resource Security
Introducing Oracle XML DB Resource Security and ACLs 23-1
How the ACL-Based Security Mechanism Works 23-2
Relationship Between ACLs and Resources 23-2
Access Control List Concepts 23-2
Oracle XML DB Supported Privileges 23-4
Atomic Privileges 23-4
Aggregate Privileges 23-5
Interaction with Database Table Security 23-6
Working with Oracle XML DB ACLs 23-6
Creating an ACL Using DBMS_XDB.createResource() 23-7
Setting the ACL of a Resource 23-7
Deleting an ACL 23-7
Updating an ACL 23-8
Updating the Entire ACL or Adding or Deleting an Entire ACE 23-8
Updating Existing ACE(s) 23-8
Retrieving the ACL Document for a Given Resource 23-8
Retrieving Privileges Granted to the Current User for a Particular Resource 23-9
Checking if the Current User Has Privileges on a Resource 23-9
Checking if the Current User Has Privileges With the ACL and Resource Owner 23-9
Retrieving the Path of the ACL that Protects a Given Resource 23-9
Retrieving the Paths of all Resources Protected by a Given ACL 23-10
Integration with LDAP 23-10
Performance Issues for Using ACLs 23-12
xix

24 FTP, HTTP, and WebDAV Access to Repository Data
Introducing Oracle XML DB Protocol Server 24-1
Session Pooling 24-2
HTTP Performance is Improved 24-2
Java Servlets 24-2
Oracle XML DB Protocol Server Configuration Management 24-2
Configuring Protocol Server Parameters 24-3
Interaction with Oracle XML DB File System Resources 24-5
Protocol Server Handles XML Schema-Based or Non-Schema-Based XML Documents 24-5
Event-Based Logging 24-6
Using FTP and Oracle XML DB Protocol Server 24-6
Oracle XML DB Protocol Server: FTP Features 24-6
Non-Supported FTP Features 24-6
Using FTP on Standard or Non-Standard Ports 24-6
FTP Server Session Management 24-7
Controlling Character Sets for FTP 24-7
Handling Error 421. Modifying the FTP Session's Default Timeout Value 24-7
Using HTTP and Oracle XML DB Protocol Server 24-8
Oracle XML DB Protocol Server: HTTP Features 24-8
Non-Supported HTTP Features 24-8
Using HTTP on Standard or Non-Standard Ports 24-8
HTTP Server and Java Servlets 24-9
Sending Multibyte Data From a Client 24-9
Non-Ascii Characters in URLs 24-9
Controlling Character Sets for HTTP 24-10
Request Character Set 24-10
Response Character Set 24-10
Using WebDAV and Oracle XML DB 24-10
Oracle XML DB WebDAV Features 24-10
Non-Supported WebDAV Features 24-11

Using Oracle XML DB and WebDAV: Creating a WebFolder in Windows 2000 24-11
25 Writing Oracle XML DB Applications in Java
Introducing Oracle XML DB Java Applications 25-1
Which Oracle XML DB APIs Are Available Inside and Outside the Database? 25-2
Design Guidelines: Java Inside or Outside the Database? 25-2
HTTP: Accessing Java Servlets or Directly Accessing XMLType Resources 25-2
Accessing Many XMLType Object Elements: Use JDBC XMLType Support 25-2
Use the Servlets to Manipulate and Write Out Data Quickly as XML 25-2
Writing Oracle XML DB HTTP Servlets in Java 25-2
Configuring Oracle XML DB Servlets 25-3
HTTP Request Processing for Oracle XML DB Servlets 25-6
The Session Pool and XML DB Servlets 25-7
Native XML Stream Support 25-7
Oracle XML DB Servlet APIs 25-7
Oracle XML DB Servlet Example 25-8
xx
Installing the Oracle XML DB Example Servlet 25-8
Configuring the Oracle XML DB Example Servlet 25-9
Testing the Example Servlet 25-9
Part VI Oracle Tools that Support Oracle XML DB
26 Managing Oracle XML DB Using Oracle Enterprise Manager
Introducing Oracle XML DB and Oracle Enterprise Manager 26-1
Getting Started with Oracle Enterprise Manager and Oracle XML DB 26-1
Enterprise Manager: Installing Oracle XML DB 26-1
You Must Register Your XML Schema with Oracle XML DB 26-2
Oracle Enterprise Manager Oracle XML DB Features 26-2
Configure Oracle XML DB 26-3
Create and Manage Resources 26-3
Manage XML Schema and Related Database Objects 26-3
The Enterprise Manager Console for Oracle XML DB 26-4

XML Database Management Window: Right-Hand Dialog Windows 26-4
Hierarchical Navigation Tree: Navigator 26-4
Configuring Oracle XML DB with Enterprise Manager 26-4
Viewing or Editing Oracle XML DB Configuration Parameters 26-7
Category: Generic 26-7
Category: FTP 26-7
Category: HTTP 26-7
Creating and Managing Oracle XML DB Resources with Enterprise Manager 26-8
Administering Individual Resources 26-10
General Resources Page 26-11
Security Page 26-11
Individual Resource Content Menu 26-12
Create Resource 26-13
Grant Privileges On 26-14
Show Contents 26-14
Show Grantee 26-15
Enterprise Manager and Oracle XML DB: ACL Security 26-15
Granting and Revoking User Privileges with User > XML Tab 26-16
Resources List 26-17
Available Privileges List 26-17
Granted List 26-17
XML Database Resource Privileges 26-18
Managing XML Schema and Related Database Objects 26-19
Navigating XML Schema in Enterprise Manager 26-19
Registering an XML Schema 26-22
General Page 26-22
Options Page 26-23
Creating Structured Storage Infrastructure Based on XML Schema 26-24
Creating Tables 26-24
Creating Views 26-24

Creating Function-Based Indexes 26-24
xxi
Creating an XMLType Table 26-24
Creating Tables with XMLType Columns 26-26
Creating a View Based on XML Schema 26-28
Creating a Function-Based Index Based on XPath Expressions 26-30
27 Loading XML Data into Oracle XML DB Using SQL*Loader
Loading XMLType Data into Oracle Database 27-1
Restoration 27-1
Using SQL*Loader to Load XMLType Data 27-1
Using SQL*Loader to Load XMLType Data in LOBs 27-2
Loading LOB Data in Predetermined Size Fields 27-2
Loading LOB Data in Delimited Fields 27-2
Loading LOB Data from LOBFILEs 27-3
Dynamic Versus Static LOBFILE Specifications 27-3
Using SQL*Loader to Load XMLType Data Directly From the Control File 27-3
Loading Very Large XML Documents into Oracle Database 27-3
28 Importing and Exporting XMLType Tables
Overview of IMPORT/EXPORT Support in Oracle XML DB 28-1
Resources and Foldering Do Not Fully Support IMPORT/EXPORT 28-1
Non-XML Schema-Based XMLType Tables and Columns 28-1
XML Schema-Based XMLType Tables 28-2
Guidelines for Exporting Hierarchy-Enabled Tables 28-2
IMPORT/EXPORT Syntax and Examples 28-2
User Level Import/Export 28-3
Table Mode Export 28-3
Metadata in Repository is Not Exported During a Full Database Export 28-4
Importing and Exporting with Different Character Sets 28-4
Part VII XML Data Exchange Using Oracle Streams Advanced Queuing
29 Exchanging XML Data With Oracle Streams AQ

What Is Oracle Streams Advanced Queuing? 29-1
How Do AQ and XML Complement Each Other? 29-1
AQ and XML Message Payloads 29-2
AQ Enables Hub-and-Spoke Architecture for Application Integration 29-3
Messages Can Be Retained for Auditing, Tracking, and Mining 29-3
Advantages of Using AQ 29-3
Oracle Streams and AQ 29-4
Streams Message Queuing 29-4
XMLType Attributes in Object Types 29-5
Internet Data Access Presentation (iDAP) 29-5
iDAP Architecture 29-5
XMLType Queue Payloads 29-6
Guidelines for Using XML and Oracle Streams Advanced Queuing 29-7
Storing Oracle Streams AQ XML Messages with Many PDFs as One Record? 29-8
xxii
Adding New Recipients After Messages Are Enqueued 29-8
Enqueuing and Dequeuing XML Messages? 29-8
Parsing Messages with XML Content from Oracle Streams AQ Queues 29-8
Preventing the Listener from Stopping Until the XML Document Is Processed 29-9
Using HTTPS with AQ 29-9
Storing XML in Oracle Streams AQ Message Payloads 29-9
Comparing iDAP and SOAP 29-9
A Installing and Configuring Oracle XML DB
Installing Oracle XML DB A-1
Installing or Reinstalling Oracle XML DB From Scratch A-1
Installing a New Oracle XML DB With Database Configuration Assistant A-1
Dynamic Protocol Registration Registers FTP and HTTP Services with Local Listener. A-2
Changing FTP or HTTP Port Numbers A-2
Postinstallation A-2
Installing a New Oracle XML DB Manually Without Database Configuration Assistant A-2

Postinstallation A-3
Reinstalling Oracle XML DB A-3
Upgrading an Existing Oracle XML DB Installation A-4
Upgrading Oracle XML DB From Release 9.2 to 10g Release 1 (10.1) A-4
Privileges for Nested XMLType Tables When Upgrading to Oracle Database 10g A-4
Configuring Oracle XML DB A-4
Oracle XML DB Configuration File, xdbconfig.xml A-5
Top Level Tag <xdbconfig> A-5
<sysconfig> A-5
<userconfig> A-5
<protocolconfig> A-5
<httpconfig> A-6
Oracle XML DB Configuration Example A-6
Oracle XML DB Configuration API A-8
Get Configuration, cfg_get() A-8
Update Configuration, cfg_update() A-8
Refresh Configuration, cfg_refresh() A-9
B XML Schema Primer
XML Schema and Oracle XML DB B-1
Namespaces B-1
XML Schema and Namespaces B-2
XML Schema Can Specify a targetNamespace Attribute B-2
XML Instance Documents Declare Which XML Schema to Use in Their Root Element B-2
schemaLocation Attribute B-2
noNamespaceSchemaLocation Attribute B-2
Declaring and Identifying XML Schema Namespaces B-3
Registering an XML Schema B-3
Oracle XML DB Creates a Default Table B-3
Deriving an Object Model: Mapping the XML Schema Constructs to SQL Types B-3
Oracle XML DB and DOM Fidelity B-4

xxiii
Annotating an XML Schema B-4
Identifying and Processing Instance Documents B-4
Introducing XML Schema B-4
Purchase Order, po.xml B-5
Association Between the Instance Document and Purchase Order Schema B-6
Purchase Order Schema, po.xsd B-6
Purchase Order Schema, po.xsd B-6
Prefix xsd: B-7
XML Schema Components B-7
Primary Components B-8
Secondary Components B-8
Helper Components B-8
Complex Type Definitions, Element and Attribute Declarations B-8
Defining the USAddress Type B-9
Defining PurchaseOrderType B-9
Occurrence Constraints: minOccurs and maxOccurs B-10
Default Attributes B-10
Default Elements B-11
Global Elements and Attributes B-12
Naming Conflicts B-12
Simple Types B-13
List Types B-17
Creating a List of myInteger B-17
Union Types B-18
Anonymous Type Definitions B-18
Two Anonymous Type Definitions B-18
Element Content B-19
Complex Types from Simple Types B-19
Mixed Content B-20

Empty Content B-21
AnyType B-22
Annotations B-22
Building Content Models B-23
Attribute Groups B-25
Adding Attributes to the Inline Type Definition B-25
Adding Attributes Using an Attribute Group B-25
Nil Values B-26
How DTDs and XML Schema Differ B-27
DTD Limitations B-28
XML Schema Features Compared to DTD Features B-28
Converting Existing DTDs to XML Schema? B-30
XML Schema Example, PurchaseOrder.xsd B-31
C XPath and Namespace Primer
Introducing the W3C XML Path Language (XPath) 1.0 Recommendation C-1
XPath Models an XML Document as a Tree of Nodes C-1
The XPath Expression C-2
xxiv
Evaluating Expressions with Respect to a Context C-2
Evaluating Subexpressions C-3
XPath Expressions Often Occur in XML Attributes C-3
Location Paths C-3
Location Path Syntax Abbreviations C-4
Location Path Examples Using Unabbreviated Syntax C-4
Location Path Examples Using Abbreviated Syntax C-5
Attribute Abbreviation @ C-6
Path Abbreviation // C-6
Location Step Abbreviation C-6
Location Step Abbreviation C-7
Abbreviation Summary C-7

Relative and Absolute Location Paths C-7
Location Path Syntax Summary C-7
XPath 1.0 Data Model C-8
Nodes C-8
Root Nodes C-8
Element Nodes C-8
Text Nodes C-9
Attribute Nodes C-9
Namespace Nodes C-10
Processing Instruction Nodes C-11
Comment Nodes C-11
Expanded-Name C-11
Document Order C-12
Introducing the W3C Namespaces in XML Recommendation C-12
What Is a Namespace? C-12
URI References C-12
Notation and Usage C-13
Declaring Namespaces C-13
Attribute Names for Namespace Declaration C-13
When the Attribute Name Matches the PrefixedAttName C-13
When the Attribute Name Matches the DefaultAttName C-14
Namespace Constraint: Leading "XML" C-14
Qualified Names C-14
Qualified Name Syntax C-14
What is the Prefix? C-14
Using Qualified Names C-14
Element Types C-14
Attribute C-15
Namespace Constraint: Prefix Declared C-15
Qualified Names in Declarations C-15

Applying Namespaces to Elements and Attributes C-15
Namespace Scoping C-15
Namespace Defaulting C-16
Uniqueness of Attributes C-17
Conformance of XML Documents C-17
xxv
Introducing the W3C XML Information Set C-18
Namespaces C-19
Entities C-19
End-of-Line Handling C-19
Base URIs C-19
Unknown and No Value C-20
Synthetic Infosets C-20
D XSLT Primer
Introducing XSL D-1
The W3C XSL Transformation Recommendation Version 1.0 D-1
Namespaces in XML D-3
XSL Style-Sheet Architecture D-3
XSL Transformation (XSLT) D-3
XML Path Language (Xpath) D-3
CSS Versus XSL D-4
XSL Style-Sheet Example, PurchaseOrder.xsl D-4
E Java APIs: Quick Reference
Java DOM API For XMLType (oracle.xdb and oracle.xdb.dom Classes) E-1
Java Methods Not Supported E-1
Oracle XML DB Resource API for Java (oracle.xdb.spi Classes) E-4
Oracle Database 10g Release 1 (10.1): New Java APIs E-8
New methods to Manage Node Values Added to XDBNode.java E-8
Java DOM APIs to Manage an Attribute Added to XDBAttribute.java E-8
New Java XMLType APIs E-9

F SQL and PL/SQL APIs: Quick Reference
XMLType API F-1
PL/SQL DOM API for XMLType (DBMS_XMLDOM) F-5
PL/SQL Parser for XMLType (DBMS_XMLPARSER) F-11
PL/SQL XSLT Processor for XMLType (DBMS_XSLPROCESSOR) F-12
DBMS_XMLSCHEMA F-13
Oracle XML DB XML Schema Catalog Views F-16
Resource API for PL/SQL (DBMS_XDB) F-16
DBMS_XMLGEN F-18
RESOURCE_VIEW, PATH_VIEW F-19
DBMS_XDB_VERSION F-20
DBMS_XDBT F-21
New PL/SQL APIs to Support XML Data in Different Character Sets F-22
G C API for XML (Oracle XML DB): Quick Reference
XML Context G-1
OCIXmlDbFreeXmlCtx() Syntax G-1
OCIXmlDbInitXmlCtx() Syntax G-1

×