Skip Headers

Oracle® XML DB Developer's Guide
10g Release 1 (10.1)

Part Number B10790-01
Go to Documentation Home
Go to Book List
Book List
Go to Table of Contents
Go to Index
Go to Master Index
Master Index
Go to Feedback page

Go to previous page
Go to next page
View PDF


This manual describes Oracle XML DB, and how it stores, generates, manipulates, manages, and queries XML in the database using Oracle XML DB.

After introducing you to the heart of Oracle XML DB, namely the XMLType framework and Oracle XML DB repository, the manual provides a brief introduction to design criteria to consider when planning your Oracle XML DB application. It provides examples of how and where you can use Oracle XML DB.

The manual then describes ways you can store and retrieve XML data using Oracle XML DB, APIs for manipulating XMLType data, and ways you can view, generate, transform, and search on existing XML data. The remainder of the manual discusses how to use Oracle XML DB repository, including versioning and security, how to access and manipulate repository resources using protocols, SQL, PL/SQL, or Java, and how to manage your Oracle XML DB application using Oracle Enterprise Manager. It also introduces you to XML messaging and Oracle Streams Advanced Queuing XMLType support.

This Preface contains these topics:

Intended Audience

This manual is intended for developers building XML Oracle Database applications.

Prerequisite Knowledge

An understanding of XML, XML Schema, XPath, and XSL is helpful when using this manual.

Many examples provided here are in SQL, PL/SQL, Java, or C, hence, a working knowledge of one or more of these languages is presumed.

Documentation Accessibility

Our goal is to make Oracle products, services, and supporting documentation accessible, with good usability, to the disabled community. To that end, our documentation includes features that make information available to users of assistive technology. This documentation is available in HTML format, and contains markup to facilitate access by the disabled community. Standards will continue to evolve over time, and Oracle is actively engaged with other market-leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers. For additional information, visit the Oracle Accessibility Program Web site at
Accessibility of Code Examples in Documentation

JAWS, a Windows screen reader, may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, JAWS may not always read a line of text that consists solely of a bracket or brace.

Accessibility of Links to External Web Sites in Documentation

This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control. Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites.


This document contains the following parts, chapters, and appendixes:

Part I, Introducing Oracle XML DB

Introduces you to the Oracle XML DB components and architecture, including XMLType and the repository. It discusses some basic design issues and provides a comprehensive set of examples of where and how you can use Oracle XML DB.

Chapter 1, " Introducing Oracle XML DB"

Introduces you to the Oracle XML DB components and architecture. It includes a description of the benefits of using Oracle XML DB, the key features, standards supported, and requirements for running Oracle XML DB. It lists Oracle XML DB-related terms used throughout the manual.

Chapter 2, " Getting Started with Oracle XML DB"

Describes how to install Oracle XML DB, compatibility and migration. It includes criteria for planning and designing your Oracle XML DB applications.

Chapter 3, " Using Oracle XML DB"

Introduces you to where and how you can use Oracle XML DB. It provides examples of storing, accessing, updating, and validating your XML data using Oracle XML DB.

Part II, Storing and Retrieving XML Data

Describes ways you can store, retrieve, validate, and transform XML data using Oracle Database 10g database native XMLType Application Program Interface (API).

Chapter 4, " XMLType Operations "

Describes how to create XMLType tables and manipulate and query XML data for non-schema-based XMLType tables and columns.

Chapter 5, " XML Schema Storage and Query: The Basics"

Describes how to use Oracle XML DB mapping from SQL to XML and back, provides an overview of how to register XML schema, deleting and updating XML schema, and how you can either use the default mapping of Oracle XML DB or specify your own.

Chapter 6, " XML Schema Storage and Query: Advanced Topics"

Describes advanced techniques for mapping from simpleType and complexType XML to SQL structures. It also describes the use of query rewrites and how to use Ordered Collections in Tables (OCTs) in Oracle XML DB.

Chapter 7, " XML Schema Evolution"

Describes how to update an XML schema registered with Oracle XML DB manually or using DBMS_XMLSCHEMA.CopyEvolve().

Chapter 8, " Transforming and Validating XMLType Data"

Describes how you can use SQL functions to transform XML data stored in the database and being retrieved or generated from the database. It also describes how you can use SQL functions to validate XML data entered into the database.

Chapter 9, " Full Text Search Over XML"

Describes how you can create an Oracle Text index on DBUriType or Oracle XML DB UriType columns and search XML data using the Oracle Text CONTAINS() function and the XMLType existsNode() function. It includes how to use CTXXPATH index for XPath querying of XML data.

Part III, Using APIs for XMLType to Access and Operate on XML

Describes the PL/SQL and Java APIs for XMLType, as well as the C DOM API for XML, and how to use them.

Chapter 10, " PL/SQL API for XMLType "

Introduces the PL/SQL DOM API for XMLType, PL/SQL Parser API for XMLType, and PL/SQL XSLT Processor API for XMLType. It includes examples and calling sequence diagrams.

Chapter 11, " DBMS_XMLSTORE"

Describes how to use PL/SQL package DBMS_XMLSTORE to insert, update, and delete XML data.

Chapter 12, " Java API for XMLType "

Describes how to use the Java (JDBC) API for XMLType. It includes examples and calling sequence diagrams.

Chapter 13, " Using C API for XML With Oracle XML DB"

Introduces the C API for XML used for XDK and Oracle XML DB applications. This chapter focuses on how to use C API for XML with Oracle XML DB.

Chapter 14, " Using ODP.NET With Oracle XML DB"

Describes how to use Oracle Data Provider for .NET (ODP.NET) with Oracle XML DB.

Part IV, Viewing Existing Data as XML

Chapter 15, " Generating XML Data from the Database"

Discusses SQL/XML, Oracle SQL/XML extension functions, and SQL functions for generating XML. SQL/XML functions include XMLElement() and XMLForest(). Oracle SQL/XML extension functions include XMLColAttValue(). SQL functions include SYS_XMLGEN(), XMLSEQUENCE(), and SYS_XMLAGG(). It also describes how to use DBMS_XMLGEN, XSQL Pages Publishing Framework, and XML SQL Utility (XSU) to generate XML data from data stored in the database.

Chapter 16, " XMLType Views"

Describes how to create XMLType views based on XML generation functions, object types, or transforming XMLType tables. It also discusses how to manipulate XML data in XMLType views.

Chapter 17, " Creating and Accessing Data Through URLs "

Introduces you to how Oracle Database works with URIs and URLs. It describes how to use UriType and associated sub-types: DBUriType, HttpUriType, and XDBUriType to create and access database data using URLs. It also describes how to create instances of UriType using the UriFactory package, how to use SYS_DBURIGEN() SQL function, and how to turn a URL into a database query using DBUri servlet.

Part V, Oracle XML DB Repository: Foldering, Security, and Protocols

Describes Oracle XML DB repository, the concepts behind it, how to use versioning, security, the protocol server, and the various associated Oracle XML DB resource APIs.

Chapter 18, " Accessing Oracle XML DB Repository Data"

Describes hierarchical indexing and foldering. Introduces you to the various Oracle XML DB repository components such as Oracle XML DB resource view API, Versioning, Oracle XML DB resource API for PL/SQL and Java.

Chapter 19, " Managing Oracle XML DB Resource Versions"

Describes how to create a version-controlled resource (VCR) and how to access and update a VCR.

Chapter 20, " SQL Access Using RESOURCE_VIEW and PATH_VIEW "

Describes how you can use SQL to access data stored in Oracle XML DB repository using Oracle XML DB resource view API. This chapter also compares the functionality of the other Oracle XML DB resource APIs.

Chapter 21, " PL/SQL Access and Management of Data Using DBMS_XDB"

Describes the Oracle XML DB resource API for PL/SQL.

Chapter 22, " Java Access to Repository Data Using Resource API for Java"

Describes Oracle XML DB resource API for Java/JNDI and how to use it to access Oracle XML DB repository data.

Chapter 23, " Oracle XML DB Resource Security"

Describes how to use Oracle XML DB resources and security and how to retrieve security information.

Chapter 24, " FTP, HTTP, and WebDAV Access to Repository Data"

Introduces Oracle XML DB protocol server and how to use FTP, HTTP, and WebDAV with Oracle XML DB.

Chapter 25, " Writing Oracle XML DB Applications in Java"

Introduces you to writing Oracle XML DB applications in Java. It describes which Java APIs are available inside and outside the database, tips for writing Oracle XML DB HTTP servlets, which parameters to use to configure servlets in the configuration file /xdbconfig.xml, and HTTP request processing.

Part VI, Oracle Tools That Support Oracle XML DB

Includes chapters that describe the tools you can use to build and manage your Oracle XML DB application.

Chapter 26, " Managing Oracle XML DB Using Oracle Enterprise Manager"

Describes how you can use Oracle Enterprise Manager to register your XML schema; create resources, XMLType tables, views, and columns; manage ACL security, configure Oracle XML DB; and create function-based indexes.

Chapter 27, " Loading XML Data into Oracle XML DB Using SQL*Loader "

Describes ways you can load XMLType data using SQL*Loader.

Chapter 28, " Importing and Exporting XMLType Tables "

Describes the IMPORT/EXPORT utility support for loading XMLType tables.

Part VII, XML Data Exchange Using Oracle Streams Advanced Queuing

Describes Oracle Streams Advanced Queuing support for XML and XMLType messaging.

Chapter 29, " Exchanging XML Data With Oracle Streams AQ "

Introduces how you can use Oracle Streams Advanced Queuing to exchange XML data. It briefly describes Oracle Streams, Internet Data Access Presentation (IDAP), using AQ XML Servlet to enqueue and dequeue messages, using IDAP, and AQ XML schemas.

Appendix A, " Installing and Configuring Oracle XML DB"

Describes how to install and configure Oracle XML DB.

Appendix B, " XML Schema Primer"

Provides a summary of the W3C XML Schema Recommendation.

Appendix C, " XPath and Namespace Primer"

Provides an introduction to W3C XPath Recommendation, Namespace Recommendation, and Information Sets.

Appendix D, " XSLT Primer "

Provides an introduction to the W3C XSL/XSLT Recommendation.

Appendix E, " Java APIs: Quick Reference "

Provides a summary of the Oracle XML DB Java API reference information.

Appendix F, " SQL and PL/SQL APIs: Quick Reference "

Provides a summary of the Oracle XML DB PL/SQL API reference information.

Appendix G, " C API for XML (Oracle XML DB): Quick Reference "

Provides a summary of the C API for XML reference information.

Appendix H, " Oracle XML DB-Supplied XML Schemas and Additional Examples"

Describes the RESOURCE_VIEW and PATH_VIEW structures and lists the sample resource XML schema supplied by Oracle XML DB.

Appendix I, " Oracle XML DB Feature Summary"

Provides a brief summary of Oracle XML DB features. It includes a list of standards supported and limitations.

Related Documents

For more information, see these Oracle Database resources:

Many of the examples in this book use the sample schemas of the seed database, which is installed by default when you install Oracle. Refer to Oracle Database Sample Schemas for information on how these schemas were created and how you can use them yourself.

Printed documentation is available for sale in the Oracle Store at

To download free release notes, installation documentation, white papers, or other collateral, please visit the Oracle Technology Network (OTN). You must register online before using OTN; registration is free and can be done at

If you already have a username and password for OTN, then you can go directly to the documentation section of the OTN Web site at


This section describes the conventions used in the text and code examples of this documentation set. It describes:

Conventions in Text

We use various conventions in text to help you more quickly identify special terms. The following table describes those conventions and provides examples of their use.

Convention Meaning Example
Bold Bold typeface indicates terms that are defined in the text or terms that appear in a glossary, or both. When you specify this clause, you create an index-organized table.
Italics Italic typeface indicates book titles or emphasis. Oracle Database Concepts

Ensure that the recovery catalog and target database do not reside on the same disk.

UPPERCASE monospace (fixed-width) font Uppercase monospace typeface indicates elements supplied by the system. Such elements include parameters, privileges, datatypes, RMAN keywords, SQL keywords, SQL*Plus or utility commands, packages and methods, as well as system-supplied column names, database objects and structures, usernames, and roles. You can specify this clause only for a NUMBER column.

You can back up the database by using the BACKUP command.

Query the TABLE_NAME column in the USER_TABLES data dictionary view.


lowercase monospace (fixed-width) font Lowercase monospace typeface indicates executables, filenames, directory names, and sample user-supplied elements. Such elements include computer and database names, net service names, and connect identifiers, as well as user-supplied database objects and structures, column names, packages and classes, usernames and roles, program units, and parameter values.

Note: Some programmatic elements use a mixture of UPPERCASE and lowercase. Enter these elements as shown.

Enter sqlplus to start SQL*Plus.

The password is specified in the orapwd file.

Back up the datafiles and control files in the /disk1/oracle/dbs directory.

The department_id, department_name, and location_id columns are in the hr.departments table.

Set the QUERY_REWRITE_ENABLED initialization parameter to true.

Connect as oe user.

The JRepUtil class implements these methods.

lowercase italic monospace (fixed-width) font Lowercase italic monospace font represents placeholders or variables. You can specify the parallel_clause.

Run old_release.SQL where old_release refers to the release you installed prior to upgrading.

Conventions in Code Examples

Code examples illustrate SQL, PL/SQL, SQL*Plus, or other command-line statements. They are displayed in a monospace (fixed-width) font and separated from normal text as shown in this example:

SELECT username FROM dba_users WHERE username = 'MIGRATE';

The following table describes typographic conventions used in code examples and provides examples of their use.

Convention Meaning Example
[ ]
Brackets enclose one or more optional items. Do not enter the brackets.
DECIMAL (digits [ , precision ])
{ }
Braces enclose two or more items, one of which is required. Do not enter the braces.

A vertical bar represents a choice of two or more options within brackets or braces. Enter one of the options. Do not enter the vertical bar.
Horizontal ellipsis points indicate either:
  • That we have omitted parts of the code that are not directly related to the example

  • That you can repeat a portion of the code

CREATE TABLE ... AS subquery;

SELECT col1, col2, ... , coln FROM employees;
Vertical ellipsis points indicate that we have omitted several lines of code not directly related to the example.
9 rows selected.
Other notation You must enter symbols other than brackets, braces, vertical bars, and ellipsis points as shown.
acctbal NUMBER(11,2);
acct    CONSTANT NUMBER(4) := 3;
Italicized text indicates placeholders or variables for which you must supply particular values.
CONNECT SYSTEM/system_password
DB_NAME = database_name
Uppercase typeface indicates elements supplied by the system. We show these terms in uppercase in order to distinguish them from terms you define. Unless terms appear in brackets, enter them in the order and with the spelling shown. However, because these terms are not case sensitive, you can enter them in lowercase.
SELECT last_name, employee_id FROM employees;
DROP TABLE hr.employees;
Lowercase typeface indicates programmatic elements that you supply. For example, lowercase indicates names of tables, columns, or files.

Note: Some programmatic elements use a mixture of UPPERCASE and lowercase. Enter these elements as shown.

SELECT last_name, employee_id FROM employees;
sqlplus hr/hr