Skip Headers

Oracle9i XML API Reference - XDK and Oracle XML DB
Release 2 (9.2)

Part Number A96616-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

28
DBMS_XMLSCHEMA and Catalog Views for PL/SQL

This chapter contains the following sections:


DBMS_XMLSCHEMA Package


Description of DBMS_XMLSCHEMA

This package is created by script dbmsxsch.sql during Oracle XML DB installation. It provides procedures to register and delete XML schemas.


Constants of DBMS_XMLSCHEMA

Table 28-1 Constants of DBMS_XMLSCHEMA  
Constant Description

DELETE_RESTRICT

CONSTANT NUMBER := 1;

DELETE_INVALIDATE

CONSTANT NUMBER := 2;

DELETE_CASCADE

CONSTANT NUMBER := 3;

DELETE_CASCADE_FORCE

CONSTANT NUMBER := 4;


Procedures and Functions of DBMS_XMLSCHEMA

Table 28-2 Summary of Functions and Procedures of DBMS_XMLSCHEMA  
Constant Description

registerSchema()

Registers the specified schema for use by Oracle. This schema can then be used to store documents conforming to this.

registerURI()

Registers an XMLSchema specified by a URI name.

deleteSchema()

Removes the schema from Oracle XML DB.

generateBean()

Generates the Java bean code corresponding to a registered XML schema

compileSchema()

Used to re-compile an already registered XML schema. This is useful for bringing a schema in an invalid state to a valid state.

generateSchema()

Generates XML schema(s) from an oracle type name.

registerSchema()

Description

Registers the specified schema for use by the Oracle XML DB. The available options are given in the following table.

Syntax Description

procedure registerSchema(schemaURL IN varchar2,

schemaDoc IN VARCHAR2,

local IN BOOLEAN := TRUE,

genTypes IN BOOLEAN := TRUE,

genbean IN BOOLEAN := FALSE,

genTables IN BOOLEAN := TRUE,

force IN BOOLEAN := FALSE,

owner IN VARCHAR2 := null);

Registers a schema specified as a VARCHAR2.

procedure registerSchema(schemaURL IN varchar2,

schemaDoc IN CLOB,

local IN BOOLEAN := TRUE,

genTypes IN BOOLEAN := TRUE,

genbean IN BOOLEAN := FASLE,

force IN BOOLEAN := FALSE,

owner IN VARCHAR2 := null);

Registers the schema specified as a CLOB.

procedure registerSchema(schemaURL IN varchar2,

schemaDoc IN BFILE,

local IN BOOLEAN := TRUE,

genTypes IN BOOLEAN := TRUE,

genbean IN BOOLEAN := FALSE,

force IN BOOLEAN := FALSE,

owner IN VARCHAR2 := null);

Registers the schema specified as a BFILE.

procedure registerSchema(schemaURL IN varchar2,

schemaDoc IN SYS.XMLType,

local IN BOOLEAN := TRUE,

genTypes IN BOOLEAN := TRUE,

genbean IN BOOLEAN := FALSE,

force IN BOOLEAN := FALSE,

owner IN VARCHAR2 := null);

Registers the schema specified as an XMLType.

procedure registerSchema(schemaURL IN varchar2,

schemaDoc IN SYS.URIType,

local IN BOOLEAN := TRUE,

genTypes IN BOOLEAN := TRUE,

genbean IN BOOLEAN := FALSE,

force IN BOOLEAN := FALSE,

owner IN VARCHAR2 := null);

Registers the schema specified as a URIType.

Parameter IN / OUT Description

schemaURL

(IN)

URL that uniquely identifies the schema document. This value is used to derive the path name of the schema document within the Oracle XML DB hierarchy.

schemaDoc

(IN)

a valid XML schema document

local

(IN)

Is this a local or global schema?

By default, all schemas are registered as local schemas, under /sys/schemas/<username/...

If a schema is registered as global, it is added under /sys/schemas/PUBLIC/....

Write privileges on PUBLIC directory are necessary to register a schema as global.

genTypes

(IN)

Should the schema compiler generate object types? By default, TRUE.

genbean

(IN)

Should the schema compiler generate Java beans? By default, FALSE.

genTables

(IN)

Should the schema compiler generate default tables? By default, TRUE.

force

(IN)

If this parameter is set to TRUE, the schema registration will not raise errors. Instead, it creates an invalid XML schema object in case of any errors. By default, the value of this parameter is FALSE.

owner

(IN)

This parameter specifies the name of the database user owning the XML schema object. By default, the user registering the schema owns the XML schema object. This parameter can be used to register a XML schema to be owned by a different database user.

registerURI()

Description

Registers an XMLSchema specified by a URI name.

Syntax

procedure registerURI(schemaURL IN varchar2,  
                      schemaDocURI IN varchar2,
                      local IN BOOLEAN := TRUE,
                      genTypes IN BOOLEAN := TRUE,
                      genbean IN BOOLEAN := FALSE,
                      genTables IN BOOLEAN := TRUE,
                      force IN BOOLEAN := FALSE,
                      owner IN VARCHAR2 := null);

Parameter IN / OUT Description

schemaURL

(IN)

A name that uniquely identifies the schema document.

schemaDocURI

(IN)

Pathname (URI) corresponding to the physical location of the schema document. The URI path could be based on HTTP, FTP, DB or Oracle XML DB protocols. This function constructs a URIType instance using the URIFactory - and invokes the registerSchema() function.

local

(IN)

Is this a local or global schema?

By default, all schemas are registered as local schemas under /sys/schemas/<username/...

If a schema is regsitered as global, it is added under /sys/schemas/PUBLIC/...

User needs write privileges on the PUBLIC directory to be able to register a schema as global.

genTypes

(IN)

Should the schema compiler generate object types? By default, TRUE.

genbean

(IN)

Should the schema compiler generate Java beans? By default, FALSE.

genTables

(IN)

Should the schema compiler generate default tables? By default, TRUE.

force

(IN)

If this parameter is set to TRUE, the schema registration will not raise errors. Instead, it creates an invalid XML schema object in case of any errors. By default, the value of this parameter is FALSE.

owner

(IN)

This parameter specifies the name of the database user owning the XML schema object. By default, the user registering the schema owns the XML schema object. This parameter can be used to register a XML schema to be owned by a different database user.

deleteSchema()

Description

Deletes the XMLSchema specified by the URL. Can result in a ORA-31001 exception: invalid resource handle or path name.

Syntax

procedure deleteSchema( schemaURL IN varchar2,
                        delete_option IN pls_integer := DELETE_RESTRICT);

Parameter IN / OUT Description

schemaURL

(IN)

URL identifying the schema to be deleted.

delete_option

(IN)

Option for deleting schema.

Options for delete_option parameter

Option Description

DELETE_RESTRICT

Schema deletion fails if there are any tables or schemas that depend on this schema.

DELETE_INVALIDATE

Schema deletion does not fail if there are any dependencies. Instead, it simply invalidates all dependent objects.

DELETE_CASCADE

Schema deletion will also drop all default SQL types and default tables. However the deletion fails if there are any stored instances conforming to this schema.

DELETE_CASCADE_FORCE

Similar to CASCADE except that it does not check for any stored instances conforming to this schema. Also it ignores any errors.

generateBean()

Description

This procedure can be used to generate the Java bean code corresponding to a registered XML schema. Note that there is also an option to generate the beans as part of the registration procedure itself. Can result in a ORA-31001 exception: invalid resource handle or path name.

Syntax

procedure generateBean(schemaURL IN varchar2);

Parameter IN / OUT Description

schemaURL

(IN)

Name identifying a registered XML schema.

compileSchema()

Description

This procedure can be used to re-compile an already registered XML schema. This is useful for bringing a schema in an invalid state to a valid state. Can result in a ORA-31001 exception: invalid resource handle or path name.

Syntax

procedure compileSchema( schemaURL IN varchar2);

Parameter IN / OUT Description

schemaURL

(IN)

URL identifying the schema.

generateSchema()

Description

These functions generate XML schema(s) from an oracle type name. Can result in a ORA-31001 exception: invalid resource handle or path name. The available options are given in the following table.

Syntax Description

function generateSchemas(

schemaName IN varchar2,

typeName IN varchar2,

elementName IN varchar2 := NULL,

schemaURL IN varchar2 := NULL,

annotate IN BOOLEAN := TRUE,

embedColl IN BOOLEAN := TRUE )

return sys.XMLSequenceType;

Returns a collection of XMLTypes, one XMLSchema document for each database schema.

function generateSchema(

schemaName IN varchar2,

typeName IN varchar2,

elementName IN varchar2 := NULL,

recurse IN BOOLEAN := TRUE,

annotate IN BOOLEAN := TRUE,

embedColl IN BOOLEAN := TRUE )

return sys.XMLType;

Inlines all in one schema (XMLType).

Parameter IN / OUT Description

schemaName

(IN)

Name of the database schema containing the type.

typeName

(IN)

Name of the oracle type.

elementName

(IN)

The name of the toplevel element in the XMLSchema defaults to typeName.

schemaURL

(IN)

Dpecifies base URL where schemas will be stored, needed by top level schema for import statement.

recurse

(IN)

Whether or not to also generate schema for all types referred to by the type specified.

annotate

(IN)

Whether or not to put the SQL annotations in the XMLSchema.

embedColl

(IN)

Should the collections be embedded in the type which refers to them, or create a complexType? Cannot be FALSE if annotations are turned on.


Catalog Views

Table 28-3 Summary of Catalog View Schemas  
Schema Description

USER_XML_SCHEMAS

All registered XML Schemas owned by the user.

ALL_XML_SCHEMAS

All registered XML Schemas usable by the current user.

DBA_XML_SCHEMAS

All registered XML Schemas in Oracle XML DB.

DBA_XML_TABLES

All XMLType tables in the system.

USER_XML_TABLES

All XMLType tables owned by the current user.

ALL_XML_TABLES

All XMLType tables usable by the current user.

DBA_XML_TAB_COLS

All XMLType table columns in the system.

USER_XML_TAB_COLS

All XMLType table columns in tables owned by the current user.

ALL_XML_TAB_COLS

All XMLType table columns in tables usable by the current user.

DBA_XML_VIEWS

All XMLType views in the system.

USER_XML_VIEWS

All XMlType views owned by the current user.

ALL_XML_VIEWS

All XMLType views usable by the current user.

DBA_XML_VIEW_COLS

All XMLType view columns in the system.

USER_XML_VIEW_COLS

All XMLType view columns in views owned by the current user.

ALL_XML_VIEW_COLS

All XMLType view columns in views usable by the current user.

USER_XML_SCHEMAS

Description

Lists all schemas (local and global) belonging to the current user.

Column Datatype Description

SCHEMA_URL

VARCHAR2

URL of XML schema

LOCAL

VARCHAR2

Local schema (YES/NO)

SCHEMA

XMLTYPE

XML Schema document

ALL_XML_SCHEMAS

Description

Lists all local schemas belonging to the current user and all global schemas.

Column Datatype Description

OWNER

VARCHAR2

Database user owning XML schema

SCHEMA_URL

VARCHAR2

URL of XML schema

LOCAL

VARCHAR2

Local schema (YES/NO)

SCHEMA

XMLTYPE

XML Schema document

DBA_XML_SCHEMAS

Description

Lists all registered local and global schemas in the system.

Column Datatype Description

OWNER

VARCHAR2

Database user owning XML schema

SCHEMA_URL

VARCHAR2

URL of XML schema

LOCAL

VARCHAR2

Local schema (YES/NO)

SCHEMA

XMLTYPE

XML Schema document

DBA_XML_TABLES

Description

Lists all XMLType tables in the system.

Column Datatype Description

OWNER

VARCHAR2

Database user owning table

TABLE_NAME

VARCHAR2

Name of XMLType table

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

STORAGE_TYPE

VARCHAR2

Storage type: CLOB / OBJECT-RELATIONAL

USER_XML_TABLES

Description

Lists all local XMLType tables belonging to the current user.

Column Datatype Description

TABLE_NAME

VARCHAR2

Name of XMLType table

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

STORAGE_TYPE

VARCHAR2

Storage type: CLOB / OBJECT-RELATIONAL

ALL_XML_TABLES

Description

Lists all local XMLType tables belonging to the current user and all global tables visible to the current user.

Column Datatype Description

OWNER

VARCHAR2

Database user owning table

TABLE_NAME

VARCHAR2

Name of XMLType table

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

STORAGE_TYPE

VARCHAR2

Storage type: CLOB / OBJECT-RELATIONAL

DBA_XML_TAB_COLS

Description

Lists all XMLType columns in the system.

Column Datatype Description

OWNER

VARCHAR2

Database user owning table

TABLE_NAME

VARCHAR2

Name of table

COLUMN_NAME

VARCHAR2

Name of XMLType column

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

STORAGE_TYPE

VARCHAR2

Storage type: CLOB / OBJECT-RELATIONAL

USER_XML_TAB_COLS

Description

Lists all XMLType columns in tables belonging to the current user.

Column Datatype Description

TABLE_NAME

VARCHAR2

Name of table

COLUMN_NAME

VARCHAR2

Name of XMLType column

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

STORAGE_TYPE

VARCHAR2

Storage type: CLOB / OBJECT-RELATIONAL

ALL_XML_TAB_COLS

Description

Lists all XMLType columns in tables belonging to the current user and all global tables visible to the current user.

Column Datatype Description

OWNER

VARCHAR2

Database user owning table

TABLE_NAME

VARCHAR2

Name of table

COLUMN_NAME

VARCHAR2

Name of XMLType column

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

STORAGE_TYPE

VARCHAR2

Storage type: CLOB / OBJECT-RELATIONAL

DBA_XML_VIEWS

Description

Lists all XMLType views in the system.

Column Datatype Description

OWNER

VARCHAR2

Database user owning view

VIEW_NAME

VARCHAR2

Name of XMLType view

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

USER_XML_VIEWS

Description

Lists all local XMLType views belonging to the current user.

Column Datatype Description

VIEW_NAME

VARCHAR2

Name of XMLType view

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

ALL_XML_VIEWS

Description

Lists all local XMLType views belonging to the current user and all global views visible to the current user.

Column Datatype Description

OWNER

VARCHAR2

Database user owning view

VIEW_NAME

VARCHAR2

Name of XMLType view

XMLSCHEMA

VARCHAR2

XML Schema URL

ELEMENT_NAME

VARCHAR2

XML Schema element

DBA_XML_VIEW_COLS

Description

Lists all XMLType columns in the system.

Column Datatype Description

OWNER

VARCHAR2

Database user owning view.

VIEW_NAME

VARCHAR2

Name of view.

COLUMN_NAME

VARCHAR2

Name of XMLType column.

XMLSCHEMA

VARCHAR2

XML Schema URL.

ELEMENT_NAME

VARCHAR2

XML Schema element.

USER_XML_VIEW_COLS

Description

Lists all XMLType columns in views belonging to the current user.

Column Datatype Description

VIEW_NAME

VARCHAR2

Name of view.

COLUMN_NAME

VARCHAR2

Name of XMLType column.

XMLSCHEMA

VARCHAR2

XML Schema URL.

ELEMENT_NAME

VARCHAR2

XML Schema element.

ALL_XML_VIEW_COLS

Description

Lists all XMLType columns in views belonging to the current user and all global views visible to the current user.

Column Datatype Description

OWNER

VARCHAR2

Database user owning view.

VIEW_NAME

VARCHAR2

Name of view.

COLUMN_NAME

VARCHAR2

Name of XMLType column.

XMLSCHEMA

VARCHAR2

XML Schema URL.

ELEMENT_NAME

VARCHAR2

XML Schema element.


Go to previous page Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback