This manual describes Oracle XML DB, and how you can use it to store, generate, manipulate, manage, and query XML data in the database.

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:


Oracle XML DB Developer's Guide is intended for developers building XML Oracle Database applications.

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. A working knowledge of one 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. Accessibility 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 more information, visit the Oracle Accessibility Program Web site at

Accessibility of Code Examples in Documentation

Screen readers 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, some screen readers 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.

TTY Access to Oracle Support Services

Oracle provides dedicated Text Telephone (TTY) access to Oracle Support Services within the United States of America 24 hours a day, seven days a week. For TTY support, call 800.446.2398.


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, "Introduction to 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: Basic"

Describes how to use Oracle XML DB mapping from SQL to XML and back, provides an overview of how to register, delete, and update XML schemas, and how to use the default mapping of Oracle XML DB or specify your own.

Chapter 6, "XPath Rewrite"

Describes the rewriting of XPath expressions to achieve optimal performance. XPath rewrite is detailed for SQL functions existsNode, extract, extractValue, XMLSequence, updateXML, insertChildXML, and deleteXML.

Chapter 7, "XML Schema Storage and Query: Advanced"

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

Chapter 8, "XML Schema Evolution"

Describes how to update an XML schema registered with Oracle XML DB manually or using PL/SQL procedure DBMS_XMLSCHEMA.copyEvolve.

Chapter 9, "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 10, "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 SQL functions contains (Oracle Text) and existsNode. 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 11, "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.

Chapter 12, "Package DBMS_XMLSTORE"

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

Chapter 13, "Java API for XMLType"

Describes how to use the Java Database Connectivity (JDBC) API for XMLType.

Chapter 14, "Using the C API for XML"

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 15, "Using Oracle Data Provider for .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

Introduces you to ways you can view your existing data as XML.

Chapter 16, "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. This chapter also describes how to use package DBMS_XMLGEN, XSQL Pages Publishing Framework, and XML SQL Utility (XSU) to generate XML data from data stored in the database.

Chapter 17, "Using XQuery with Oracle XML DB"

Describes Oracle XML DB support for the XQuery 1.0 language developed by W3C. SQL function XMLQuery is used to construct or query XML data using XQuery. SQL function XMTable is used to create relational values from XQuery results.

Chapter 18, "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 19, "Accessing Data Through URIs"

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 package URIFACTORY, how to use SQL function sys_DburiGen, 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 20, "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 21, "Managing Resource Versions"

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

Chapter 22, "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 23, "PL/SQL Access Using DBMS_XDB"

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

Chapter 24, "Repository Resource Security"

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

Chapter 25, "FTP, HTTP(S), 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 26, "User-Defined Repository Metadata"

Describes how to create and use custom XML metadata, which you associate with XML data and store in Oracle XML DB Repository. You can use such metadata to group or classify data, in order to process it in different ways.

Chapter 27, "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 28, "Administering Oracle XML DB"

Describes how to install, update, and configure Oracle XML DB.

Chapter 29, "Loading XML Data Using SQL*Loader"

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

Chapter 30, "Importing and Exporting XMLType Tables"

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

Chapter 31, "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.

Part VII, Appendixes

Provides background material for developing XML applications with Oracle XML DB.

Appendix A, "XML Schema Primer"

Provides a summary of the W3C XML Schema Recommendation.

Appendix B, "XPath and Namespace Primer"

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

Appendix C, "XSLT Primer"

Provides an introduction to the W3C XSL/XSLT Recommendation.

Appendix D, "Oracle-Supplied XML Schemas and Examples"

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

Appendix E, "Oracle XML DB Restrictions"

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 resources:

Many of the examples in this book use the sample schemas, which are installed by default when you select the Basic Installation option with an Oracle Database installation. 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

For additional information, see:


Throughout this manual, "XML Schema" refers to the XML Schema 1.0 recommendation,


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, Recovery Manager 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 executable programs, filenames, directory names, and sample user-supplied elements. Such elements include computer and database names, net service names and connect identifiers, 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';


To promote readability, especially of lengthy or complex XML data, output is sometimes shown pretty-printed (formatted) in code examples.

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

Convention Meaning Example
[ ]
Anything enclosed in brackets is optional.
DECIMAL (digits [ , precision ])
{ }
Braces are used for grouping items.
A vertical bar represents a choice of two options.
Ellipsis points mean repetition in syntax descriptions.

In addition, ellipsis points can mean an omission in code examples or text.

SELECT col1, col2, ... , coln FROM employees;

CREATE TABLE ... AS subquery;
Other symbols You must use symbols other than brackets ([ ]), braces ({ }), vertical bars (|), and ellipsis points (...) exactly 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. Because these terms are not case sensitive, you can use them in either UPPERCASE or lowercase.
SELECT last_name, employee_id FROM employees;
DROP TABLE hr.employees;
Lowercase typeface indicates user-defined programmatic elements, such as 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