Skip Headers

Oracle9i XML Database Developer's Guide - Oracle XML DB
Release 2 (9.2)

Part Number A96620-02
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, the Oracle9i XML database. It describes how XML data can be stored, generated, manipulated, managed, and queried 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 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 Advanced Queueing XMLType support.

The Preface contains the following sections:


This manual is intended for developers building XML applications on Oracle9i database.

Prerequisite Knowledge

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

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


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, and some preliminary application planning issues.

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 the ways you can store, retrieve, validate, and transform XML data using Oracle9i database native XMLType API.

Chapter 4, "Using XMLType"

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

Chapter 5, "Structured Mapping of XMLType"

Describes how to use Oracle XML DB mapping from SQL to XML and back, provides an overview of how you must register your XML schema, how you can either use Oracle XML DBs default mapping or specify your own mapping. It also describes how to use Ordered Collections in Tables (OCTs) in Oracle XML DB.

Chapter 6, "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 being input into the database.

Chapter 7, "Searching XML Data with Oracle Text"

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

PART III. Using XMLType APIs to Manipulate XML Data

Describes the PL/SQL and Java XMLType APIs and how to use them.

Chapter 8, "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 9, "Java API for XMLType"

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

PART IV. Viewing Existing Data as XML

Chapter 10, "Generating XML Data from the Database"

Discusses SQLX, Oracle SQLX extension functions, and SQL functions for generating XML. SQLX functions include XMLElement()and XMLForest(). Oracle SQLX 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 11, "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 12, "Creating and Accessing Data Through URLs"

Introduces you to how Oracle9i database works with URIs and URLs. It describes how to use UriTypes 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, ACL security, the Protocol Server, and the various associated Oracle XML DB Resource APIs.

Chapter 13, "Oracle XML DB Foldering"

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 14, "Oracle XML DB Versioning"

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


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 16, "Oracle XML DB Resource API for PL/SQL (DBMS_XDB)"

Describes DBMS_Oracle XML DB and the Oracle XML DB Resource API for PL/SQL.

Chapter 17, "Oracle XML DB 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 18, "Oracle XML DB Resource Security"

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

Chapter 19, "Using FTP, HTTP, and WebDAV Protocols"

Introduces Oracle XML DB Protocol Server and how to use FTP, HTTP, and WebDAV with Oracle XML DB.

Chapter 20, "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 Development

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

Chapter 21, "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 22, "Loading XML Data into Oracle XML DB"

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

Chapter 23, "Importing and Exporting XMLType Tables"

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

PART VII. XML Data Exchange Using Advanced Queueing

Describes Oracle Advanced Queueing support for XML and XMLType messaging.

Chapter 24, "Exchanging XML Data Using Advanced Queueing (AQ) and Oracle Streams"

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

PART VIII. Oracle XML DB Case Studies

Describes two XML DB-based applications.

Chapter 25, "Oracle XML DB Case Study: Web Services Retrieve and Display XML Documents"

Provides the calling sequence and code for building an XML DB Web Services based purchase order application.

Chapter 26, "Oracle XML DB Basic Demo"

Provides many examples and illustrations of ways to store, access, and manipulate purchase order XML document using XML DB.

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 DOM API for XMLType, Resource API for Java: Quick Reference"

Provides a quick reference for the Oracle XML DB Java APIs.

Appendix F, "Oracle XML DB XMLType API, PL/SQL and Resource PL/SQL APIs: Quick Reference"

Provides a quick reference for the Oracle XML DB PL/SQL APIs.

Appendix G, "Example Setup scripts. Oracle XML DB - Supplied XML Schemas"

Provides a description of the setup scripts used for the examples in Chapter 3. It also descibes the RESOURCE_VIEW and PATH_VIEW structures and lists the Oracle XML DB- supplied sample resource XML schema.


Related Documentation

For more information, see these Oracle resources:

Some 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 Oracle9i Sample Schemas for information on how these schemas were created and how you can use them yourself.

In North America, printed documentation is available for sale in the Oracle Store at

Customers in Europe, the Middle East, and Africa (EMEA) can purchase documentation from

Other customers can contact their Oracle representative to purchase printed documentation.

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

To access the database documentation search engine directly, please visit


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 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.


Italic typeface indicates book titles or emphasis.

Oracle9i 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 open 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 Uold_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.

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


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 Corporation 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 Corporation does not own or control. Oracle Corporation neither evaluates nor makes any representations regarding the accessibility of these Web sites.