Oracle® XML DB Developer's Guide 10g Release 1 (10.1) Part Number B10790-01 |
|
|
View PDF |
This appendix provides a summary of the Oracle XML DB SQL and PL/SQL application program interfaces (APIs).
This appendix contains these topics:
XMLType
is a system-defined opaque type for handling XML data. XMLType
has predefined member functions to extract XML nodes and fragments. You can create columns of XMLType
and insert XML documents into them. You can also generate XML documents as XMLType
instances dynamically using SQL functions, SYS_XMLGEN
and SYS_XMLAGG
, the PL/SQL package DBMS_XMLGEN
, and
the SQLX functions.
Table F-1 lists the XMLType
API functions.
Table F-1 XMLType API
Table F-2 lists the PL/SQL Document Object Model (DOM) API for XMLType
(DBMS_XMLDOM
) methods supported in release 2 (9.2.0.1). These are grouped according to the W3C DOM Recommendation. The following DBMS_XMLDOM
methods are not supported in release 2 (9.2.0.2):
hasFeature
getVersion
setVersion
getCharset
setCharset
getStandalone
setStandalone
writeExternalDTDToFile
writeExternalDTDToBuffer
writeExternalDTDToClob
Table F-3 lists additional methods supported in release 2 (9.2.0.2).
Table F-2 Summary of Release 2 (9.2.0.1) DBMS_XMLDOM Methods
Group/Method | Description |
---|---|
Node methods | -- |
isNull() |
Tests if the node is NULL. |
makeAttr() |
Casts the node to an attribute. |
makeCDataSection() |
Casts the node to a CDataSection . |
makeCharacterData() |
Casts the node to CharacterData . |
makeComment() |
Casts the node to a Comment . |
makeDocumentFragment() |
Casts the node to a DocumentFragment . |
makeDocumentType() |
Casts the node to a Document Type. |
makeElement() |
Casts the node to an element. |
makeEntity() |
Casts the node to an Entity . |
makeEntityReference() |
Casts the node to an EntityReference . |
makeNotation() |
Casts the node to a Notation . |
makeProcessingInstruction() |
Casts the node to a DOMProcessingInstruction . |
makeText() |
Casts the node to a DOMText . |
makeDocument() |
Casts the node to a DOMDocument . |
writeToFile() |
Writes the contents of the node to a file. |
writeToBuffer() |
Writes the contents of the node to a buffer. |
writeToClob() |
Writes the contents of the node to a CLOB . |
getNodeName() |
Retrieves the Name of the Node. |
getNodeValue() |
Retrieves the Value of the Node. |
setNodeValue() |
Sets the Value of the Node. |
getNodeType() |
Retrieves the Type of the node. |
getParentNode() |
Retrieves the parent of the node. |
getChildNodes() |
Retrieves the children of the node. |
getFirstChild() |
Retrieves the first child of the node. |
getLastChild() |
Retrieves the last child of the node. |
getPreviousSibling() |
Retrieves the previous sibling of the node. |
getNextSibling() |
Retrieves the next sibling of the node. |
getAttributes() |
Retrieves the attributes of the node. |
getOwnerDocument() |
Retrieves the owner document of the node. |
insertBefore() |
Inserts a child before the reference child. |
replaceChild() |
Replaces the old child with a new child. |
removeChild() |
Removes a specified child from a node. |
appendChild() |
Appends a new child to the node. |
hasChildNodes() |
Tests if the node has child nodes. |
cloneNode() |
Clones the node. |
Named node map methods | -- |
isNull() |
Tests if the NodeMap is NULL. |
getNamedItem() |
Retrieves the item specified by the name. |
setNamedItem() |
Sets the item in the map specified by the name. |
removeNamedItem() |
Removes the item specified by name. |
item() |
Retrieves the item given the index in the map. |
getLength() |
Retrieves the number of items in the map. |
Node list methods | -- |
isNull() |
Tests if the Nodelist is NULL. |
item() |
Retrieves the item given the index in the nodelist. |
getLength() |
Retrieves the number of items in the list. |
Attr methods | -- |
isNull() |
Tests if the attribute Node is NULL. |
makeNode() |
Casts the atribute to a node. |
getQualifiedName() |
Retrieves the Qualified Name of the attribute. |
getNamespace() |
Retrieves the NS URI of the attribute. |
getLocalName() |
Retrieves the local name of the attribute. |
getExpandedName() |
Retrieves the expanded name of the attribute. |
getName() |
Retrieves the name of the attribute. |
getSpecified() |
Tests if attribute was specified in the owning element. |
getValue() |
Retrieves the value of the attribute. |
setValue() |
Sets the value of the attribute. |
CData section methods | -- |
isNull() |
Tests if the CDataSection is NULL. |
makeNode() |
Casts the CDatasection to a node. |
Character data methods | -- |
isNull() |
Tests if the CharacterData is NULL. |
makeNode() |
Casts the CharacterData to a node. |
getData() |
Retrieves the data of the node. |
setData() |
Sets the data to the node. |
getLength() |
Retrieves the length of the data. |
substringData() |
Retrieves the substring of the data. |
appendData() |
Appends the given data to the node data. |
insertData() |
Inserts the data in the node at the given offSets. |
deleteData() |
Deletes the data from the given offSets. |
replaceData() |
Replaces the data from the given offSets. |
Comment methods | -- |
isNull() |
Tests if the comment is NULL. |
makeNode() |
Casts the Comment to a node. |
DOM implementation methods | -- |
isNull() |
Tests if the DOMImplementation node is NULL. |
hasFeature() |
Tests if the DOM implements a given feature. [Not supported in this release] |
Document fragment methods | -- |
isNull() |
Tests if the DocumentFragment is NULL. |
makeNode() |
Casts the Document Fragment to a node. |
Document type methods | -- |
isNull() |
Tests if the Document Type is NULL. |
makeNode() |
Casts the document type to a node. |
findEntity() |
Finds the specified entity in the document type. |
findNotation() |
Finds the specified notation in the document type. |
getPublicId() |
Retrieves the public ID of the document type. |
getSystemId() |
Retrieves the system ID of the document type. |
writeExternalDTDToFile() |
Writes the document type definition to a file. |
writeExternalDTDToBuffer() |
Writes the document type definition to a buffer. |
writeExternalDTDToClob() |
Writes the document type definition to a clob. |
getName() |
Retrieves the name of the Document type. |
getEntities() |
Retrieves the node map of entities in the Document type. |
getNotations() |
Retrieves the nodemap of the notations in the Document type. |
Element methods | -- |
isNull() |
Tests if the element is NULL. |
makeNode() |
Casts the element to a node. |
getQualifiedName() |
Retrieves the qualified name of the element. |
getNamespace() |
Retrieves the NS URI of the element. |
getLocalName() |
Retrieves the local name of the element. |
getExpandedName() |
Retrieves the expanded name of the element. |
getChildrenByTagName() |
Retrieves the children of the element by tag name. |
getElementsByTagName() |
Retrieves the elements in the subtree by element. |
resolveNamespacePrefix() |
Resolve the prefix to a namespace uri. |
getTagName() |
Retrieves the Tag name of the element. |
getAttribute() |
Retrieves the attribute node specified by the name. |
setAttribute() |
Sets the attribute specified by the name. |
removeAttribute() |
Removes the attribute specified by the name. |
getAttributeNode() |
Retrieves the attribute node specified by the name. |
setAttributeNode() |
Sets the attribute node in the element. |
removeAttributeNode() |
Removes the attribute node in the element. |
normalize() |
Normalizes the text children of the element. [Not supported in this release] |
Entity methods | -- |
isNull() |
Tests if the Entity is NULL. |
makeNode() |
Casts the Entity to a node. |
getPublicId() |
Retrieves the public Id of the entity. |
getSystemId() |
Retrieves the system Id of the entity. |
getNotationName() |
Retrieves the notation name of the entity. |
Entity reference methods | -- |
isNull() |
Tests if the entity reference is NULL. |
makeNode() |
Casts the Entity reference to NULL . |
Notation methods |
-- |
isNull() |
Tests if the notation is NULL. |
makeNode() |
Casts the notation to a node. |
getPublicId() |
Retrieves the public Id of the notation. |
getSystemId() |
Retrieves the system Id of the notation. |
Processing instruction methods | -- |
isNull() |
Tests if the processing instruction is NULL. |
makeNode() |
Casts the Processing instruction to a node. |
getData() |
Retrieves the data of the processing instruction. |
getTarget() |
Retrieves the target of the processing instruction. |
setData() |
Sets the data of the processing instruction. |
Text methods | -- |
isNull() |
Tests if the text is NULL. |
makeNode() |
Casts the text to a node. |
splitText() |
Splits the contents of the text node into two text nodes. |
Document methods | -- |
isNull() |
Tests if the document is NULL . |
makeNode() |
Casts the document to a node. |
newDOMDocument() |
Creates a new document. |
freeDocument() |
Frees the document. |
getVersion() |
Retrieves the version of the document. [Not supported in this release] |
setVersion() |
Sets the version of the document. [Not supported in this release] |
getCharset() |
Retrieves the Character set of the document. [Not supported in this release] |
setCharset() |
Sets the Character set of the document. [Not supported in this release] |
getStandalone() |
Retrieves if the document is specified as standalone. [Not supported in this release] |
setStandalone() |
Sets the document standalone. [Not supported in this release] |
writeToFile() |
Writes the document to a file. |
writeToBuffer() |
Writes the document to a buffer. |
writeToClob() |
Writes the document to a clob. |
writeExternalDTDToFile() |
Writes the DTD of the document to a file. [Not supported in this release] |
writeExternalDTDToBuffer() |
Writes the DTD of the document to a buffer. [Not supported in this release] |
writeExternalDTDToClob() |
Writes the DTD of the document to a clob. [Not supported in this release] |
getDoctype() |
Retrieves the DTD of the document. |
getImplementation() |
Retrieves the DOM implementation. |
getDocumentElement() |
Retrieves the root element of the document. |
createElement() |
Creates a new element. |
createDocumentFragment() |
Creates a new document fragment. |
createTextNode() |
Creates a Text node. |
createComment() |
Creates a comment node. |
createCDATASection() |
Creates a CDatasection node. |
createProcessingInstruction() |
Creates a processing instruction. |
createAttribute() |
Creates an attribute. |
createEntityReference() |
Creates an Entity reference. |
getElementsByTagName() |
Retrieves the elements in the by tag name. |
Table F-3 DBMS_XMLDOM Methods Added in Release 2 (9.2.0.2)
Method | Syntax |
---|---|
createDocument |
FUNCTION createDocument (namspaceURI IN VARCHAR2, qualifiedName IN VARCHAR2, doctype IN DOMType :=NULL) REURN DocDocument; |
getPrefix |
FUNCTION getPrefix(n DOMNode) RETURN VARCHAR2; |
setPrefix |
PROCEDURE setPrefix (n DOMNode) RETURN VARCHAR2; |
hasAttributes |
FUNCTION hasAttributes (n DOMNode) RETURN BOOLEAN; |
getNamedItem |
FUNCTION getNamedItem (nnm DOMNamedNodeMap, name IN VARCHAR2, ns IN VARCHAR2) RETURN DOMNode; |
setNamedItem |
FUNCTION getNamedItem (nnm DOMNamedNodeMap, arg IN DOMNode, ns IN VARCHAR2) RETURN DOMNode; |
removeNamedItem |
FUNCTION removeNamedItem (nnm DOMNamesNodeMap, name in VARCHAR2, ns IN VARCHAR2) RETURN DOMNode; |
getOwnerElement |
FUNCTION getOwnerElement (a DOMAttr) RETURN DOMElement; |
getAttribute |
FUNCTION getAttribute (elem DOMElement, name IN VARCHAR2, ns IN VARCHAR2) RETURN VARCHAR2; |
hasAttribute |
FUNCTION hasAttribute (elem DOMElement, name IN VARCHAR2) RETURN BOOLEAN; |
hasAttribute |
FUNCTION hasAttribute (elem DOMElement, name IN VARCHAR2, ns IN VARCHAR2) RETURN BOOLEAN; |
setAttribute |
PROCEDURE setAttribute (elem DOMElement, name IN VARCHAR2, newvalue IN VARCHAR2, ns IN VARCHAR2); |
removeAttribute |
PROCEDURE removeAttribute (elem DOMElement, name IN VARCHAR2, ns IN VARCHAR2); |
getAttributeNode |
FUNCTION getAttributeNode(elem DOMElement, name IN VARCHAR2, ns IN VARCHAR2) RETURN DOMAttr; |
setAttributeNode |
FUNCTION setAttributeNode(elem DOMElement, newAttr IN DOMAttr, ns IN VARCHAR2) RETURN DOMAttr; |
createElement |
FUNCTION createElement (doc DOMDocument, tagname IN VARCHAR2, ns IN VARCHAR2) RETURN DOMElement; |
createAttribute |
FUNCTION createAttribute (doc DOMDocument, name IN VARCHAR2, ns IN VARCHAR2) RETURN DOMAttr; |
You can access the content and structure of XML documents through the PL/SQL Parser for XMLType
(DBMS_XMLPARSER
).
Table F-4 lists the PL/SQL Parser for XMLType
(DBMS_XMLPARSER
) functions and procedures.
Table F-4 DBMS_XMLPARSER Functions and Procedures
Functions/Procedures | Description |
---|---|
parse() |
Parses XML stored in the given URL/file. |
newParser() |
Returns a new parser instance |
parseBuffer() |
Parses XML stored in the given buffer |
parseClob() |
Parses XML stored in the given clob |
parseDTD() |
Parses DTD stored in the given url/file |
parseDTDBuffer() |
Parses DTD stored in the given buffer |
parseDTDClob() |
Parses DTD stored in the given clob |
setBaseDir() |
Sets base directory used to resolve relative URLs. |
showWarnings() |
Turns warnings on or off. |
setErrorLog() |
Sets errors to be sent to the specified file |
setPreserveWhitespace() |
Sets white space preserve mode |
setValidationMode() |
Sets validation mode. |
getValidationMode() |
Returns validation mode. |
setDoctype() |
Sets DTD. |
getDoctype() |
Gets DTD Parser. |
getDocument() |
Gets DOM document. |
freeParser() |
Frees a parser object. |
getReleaseVersion() |
Returns the release version of Oracle XML Parser for PL/SQL. |
This PL/SQL implementation of the XSL processor follows the W3C XSLT Working Draft (Rev WD-xslt-19990813).
Table F-5 summarizes the PL/SQL XSLT Processor for XMLType
(DBMS_XSLPROCESSOR
) functions and procedures.
Table F-5 PL/SQL XSLT Processor for XMLType (DBMS_XSLPROCESSOR) Functions
Functions and Procedures | Description |
---|---|
newProcessor() |
Returns a new processor instance. |
processXSL() |
Transforms an input XML document. |
showWarnings() |
Turns warnings on or off. |
setErrorLog() |
Sets errors to be sent to the specified file. |
newStylesheet() |
Creates a new style sheet using the given input and reference URLs. |
transformNode() |
Transforms a node in a DOM tree using the given style sheet. |
selectNodes() |
Selects nodes from a DOM tree that match the given pattern. |
selectSingleNodes() |
Selects the first node from the tree that matches the given pattern. |
valueOf() |
Retrieves the value of the first node from the tree that matches the given pattern |
setParam() |
Sets a top-level parameter in the style sheet |
removeParam() |
Removes a top-level style-sheet parameter |
resetParams() |
Resets the top-level style-sheet parameters |
freeStylesheet() |
Frees a style-sheet object |
freeProcessor() |
Frees a processor object |
This package is created by dbmsxsch.sql
during the Oracle XML DB installation. It provides procedures for registering and deleting your XML schemas. Table F-6 summarizes the DBMS_XMLSCHEMA
functions and procedures.
Table F-6 DBMS_XMLSCHEMA Functions and Procedures
Constant | Description |
---|---|
registerSchema() 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 the specified XML schema for use by Oracle XML DB. This schema can then be used to store documents that conform to it.
Parameters:
|
procedure registerSchema(schemaURL IN varchar2, schemaDoc IN BLOB,local IN BOOLEAN := TRUE, TRUE, genbean IN BOOLEAN := FALSE, genTables IN BOOLEAN := TRUE,force IN BOOLEAN := FALSE, owner IN VARCHAR2 := '', csid IN NUMBER); |
|
registerURI() 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) ; |
Registers an XML schema specified by a URI name. |
deleteSchema() procedure deleteSchema(schemaURL IN varchar2, delete_option IN pls_integer := DELETE_RESTRICT); |
Removes the XML schema from Oracle XML DB. |
generateBean() procedure generateBean(schemaURL IN varchar2) ; |
Generates the Java Bean code corresponding to a registered XML schema. |
compileSchema() procedure compileSchema( schemaURL IN varchar2); |
Recompiles an already registered XML schema. Useful for bringing an invalid schema to a valid state. |
generateSchema() 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;
f |
Generates XML schema(s) from an Oracle type name. |
DBMS_XMLSCHEMA
constants:
DELETE_RESTRICT
, CONSTANT NUMBER := 1;
DELETE_INVALIDATE
, CONSTANT NUMBER := 2;
DELETE_CASCADE,
CONSTANT NUMBER := 3;
DELETE_CASCADE_FORCE
, CONSTANT NUMBER := 4;
Table F-7 lists the Oracle XML DB XML schema catalog views.
Table F-7 Oracle XML DB: XML Schema Catalog View
Schema | Description |
---|---|
USER_XML_SCHEMAS |
Lists all registered XML Schemas owned by the user. |
ALL_XML_SCHEMAS |
Lists all registered XML Schemas usable by the current user. |
DBA_XML_SCHEMAS |
Lists all registered XML Schemas in Oracle XML DB. |
DBA_XML_TABLES |
Lists all XMLType tables in the system. |
USER_XML_TABLES |
Lists all XMLType tables owned by the current user. |
ALL_XML_TABLES |
Lists all XMLType tables usable by the current user. |
DBA_XML_TAB_COLS |
Lists all XMLType table columns in the system. |
USER_XML_TAB_COLS |
Lists all XMLType table columns in tables owned by the current user. |
ALL_XML_TAB_COLS |
Lists all XMLType table columns in tables usable by the current user. |
DBA_XML_VIEWS |
Lists all XMLType views in the system. |
USER_XML_VIEWS |
Lists all XMlType views owned by the current user. |
ALL_XML_VIEWS |
Lists all XMLType views usable by the current user. |
DBA_XML_VIEW_COLS |
Lists all XMLType view columns in the system. |
USER_XML_VIEW_COLS |
Lists all XMLType view columns in views owned by the current user. |
ALL_XML_VIEW_COLS |
Lists all XMLType view columns in views usable by the current user. |
Resource API for PL/SQL (DBMS_XDB)
PL/SQL package provides functions for the following Oracle XML DB tasks:
Resource management of Oracle XML DB hierarchy. These functions complement the functionality provided by Resource Views.
Oracle XML DB Access Control List (ACL) for security management. The ACL-based security mechanism can be used for either:
In-hierarchy ACLs, ACLs stored through Oracle XML DB resource API
In-memory ACLs, that can be stored outside Oracle XML DB.
Some of these methods can be used for both Oracle XML DB resources and arbitrary database objects. AclCheckPrivileges()
enables database users access to Oracle XML DB ACL-based security mechanism without having to store their objects in the Oracle XML DB hierarchy.
Oracle XML DB configuration session management.
Rebuilding of hierarchical indexes.
Table F-8 summarizes the DBMS_XDB functions and procedures.
Table F-8 DBMS_XDB Functions and Procedures
Function/Procedure | Description |
---|---|
getAclDocument() FUNCTION getAclDocument(abspath IN VARCHAR2) RETURN sys.xmltype; |
Retrieves ACL document that protects resource given its path name. |
getPrivileges() FUNCTION getPrivileges(res_path IN VARCHAR2) RETURN sys.xmltype; |
Gets all privileges granted to the current user on the given XML DB resource. |
changePrivileges() FUNCTION changePrivileges(res_path IN VARCHAR2, ace IN XMLType) RETURN pls_integer; |
Adds the given access control entry (ACE) to the given resource access control list (ACL). |
checkPrivileges() FUNCTION checkPrivileges(res_path IN VARCHAR2, privs IN XMLType) RETURN pls_integer; |
Checks access privileges granted to the current user on the specified XML DB resource. |
setacl() PROCEDURE setacl(res_path IN VARCHAR2, acl_path IN VARCHAR2); |
Sets the ACL on the given XML DB resource to be the ACL specified. |
AclCheckPrivileges() FUNCTION AclCheckPrivileges(acl_path IN VARCHAR2,owner IN VARCHAR2, privs IN XMLType) RETURN pls_integer; |
Checks access privileges granted to the current user by specified ACL document on a resource whose owner is specified by the 'owner' parameter. |
LockResource() FUNCTION LockResource(path IN VARCHAR2, depthzero IN BOOLEAN,shared IN boolean) RETURN BOOLEAN; |
Gets a WebDAV-style lock on that resource given a path to that resource. |
GetLockToken() PROCEDURE GetLockToken(path IN VARCHAR2,locktoken OUT VARCHAR2); |
Returns that resource lock token for the current user given a path to a resource. |
UnlockResource() FUNCTION UnlockResource(path IN VARCHAR2,deltoken IN VARCHAR2) RETURN BOOLEAN; |
Unlocks the resource given a lock token and a path to the resource. |
CreateResource() FUNCTION CreateResource(path IN VARCHAR2,data IN VARCHAR2) RETURN BOOLEAN; FUNCTION CreateResource(path IN VARCHAR2, data IN SYS.XMLTYPE) RETURN BOOLEAN; FUNCTION CreateResource(path IN VARCHAR2, datarow IN REF SYS.XMLTYPE) RETURN BOOLEAN FUNCTION CreateResource(path IN VARCHAR2, data IN CLOB) RETURN BOOLEAN; FUNCTION CreateResource(abspath IN VARCHAR2,data IN BFILE,csid IN NUMBER:= 0) RETURN BOOLEAN; FUNCTION CreateResource(abspath IN VARCHAR2, data IN BLOB,csid IN NUMBER:= 0) RETURN BOOLEAN; |
Creates a new resource. |
CreateFolder() FUNCTION CreateFolder(path IN VARCHAR2) RETURN BOOLEAN; |
Creates a new folder resource in the hierarchy. |
DeleteResource() PROCEDURE DeleteResource(path IN VARCHAR2); |
Deletes a resource from the hierarchy. |
Link() PROCEDURE Link(srcpath IN VARCHAR2, linkfolder IN VARCHAR2, linkname IN VARCHAR2); |
Creates a link to an existing resource. |
CFG_Refresh() PROCEDURE CFG_Refresh; |
Refreshes the session configuration information to the latest configuration. |
CFG_Get() FUNCTION CFG_Get RETURN SYS.XMLType; |
Retrieves the session configuration information. |
CFG_Update() PROCEDURE CFG_Update(xdbconfig IN SYS.XMLTYPE); |
Updates the configuration information. |
PL/SQL package DBMS_XMLGEN
transforms SQL query results into a canonical XML format. It inputs an arbitrary SQL query, converts it to XML, and returns the result as a CLOB
. DBMS_XMLGEN
is similar to the DBMS_XMLQUERY
, except that it is written in C and compiled in the kernel. This package can only be run in the database.
Table F-9 summarizes the DBMS_XMLGEN
functions and procedures.
Table F-9 DBMS_XMLGEN Functions and Procedures
Function/Procedure | Description |
---|---|
|
Creates a new context handle. |
|
Sets the name of the element enclosing each row of the result. The default tag is ROW. |
|
Sets the name of the element enclosing the entire result. The default tag is ROWSET. |
|
Gets the XML document. |
|
Gets the number of SQL rows that were processed in the last call to getXML. |
|
Sets the maximum number of rows to be fetched each time. |
|
Sets the number of rows to skip every time before generating the XML. The default is 0. |
|
Sets whether special characters such as $, which are non-XML characters, should be converted or not to their escaped representation. The default is to perform the conversion. |
|
Converts the XML into the escaped or unescaped XML equivalent. |
|
Forces the use of the collection column name appended with the tag _ITEM for collection elements. The default is to set the underlying object type name for the base element of the collection. |
|
Restarts the query to start fetching from the beginning. |
closeContext() |
Closes the context and releases all resources. |
Oracle XML DB RESOURCE_VIEW
and PATH_VIEW
provide a mechanism for SQL-based access of data stored in the Oracle XML DB repository. Data stored in the Oracle XML DB repository through protocols such as FTP or WebDAV API can be accessed in SQL through RESOURCE_VIEW
and PATH_VIEW
.
Oracle XML DB resource API for PL/SQL is based on RESOURCE_VIEW
, PATH_VIEW
and some PL/SQL packages. It provides query and DML functionality. PATH_VIEW
has one row for each unique path in the repository, whereas RESOURCE_VIEW
has one row for each resource in the repository.
Table F-10 summarizes the Oracle XML DB resource API for PL/SQL operators.
Table F-10 RESOURCE_VIEW, PATH_VIEW Operators
Operator | Description |
---|---|
UNDER_PATH INTEGER UNDER_PATH( resource_column, pathname); INTEGER UNDER_PATH( resource_column, depth, pathname); INTEGER UNDER_PATH( resource_column, pathname, correlation); INTEGER UNDER_PATH( resource_column, depth, pathname, correlation); |
Using the Oracle XML DB hierarchical index, returns sub-paths of a particular path.
Parameters:
|
EQUALS_PATH INTEGER EQUALS_PATH( resource_column, pathname); |
Finds the resource with the specified path name. |
PATH VARCHAR2 PATH(correlation); |
Returns the relative path name of the resource under the specified path name argument. |
DEPTH INTEGER DEPTH(correlation) |
Returns the folder depth of the resource under the specified starting path. |
DBMS_XDB_VERSION
along with DBMS_XDB
implement the Oracle XML DB versioning API.
Table F-11 summarizes the DBMS_XDB_VERSION
functions and procedures.
Table F-11 DBMS_XDB_VERSION Functions and Procedures
Function/Procedure | Description |
---|---|
MakeVersioned() FUNCTION MakeVersioned(pathname VARCHAR2) RETURN dbms_xdb.resid_type; |
Turns a regular resource whose path name is given into a version-controlled resource. |
Checkout() PROCEDURE Checkout(pathname VARCHAR2); |
Checks out a VCR before updating or deleting it. |
Checkin() FUNCTION Checkin(pathname VARCHAR2) RETURN dbms_xdb.resid_type; |
Checks in a checked-out VCR and returns the resource id of the newly-created version. |
Uncheckout() FUNCTION Uncheckout( pathname VARCHAR2) RETURN dbms_xdb.resid_type; |
Checks in a checked-out resource and returns the resource id of the version before the resource is checked out. |
GetPredecessors() FUNCTION GetPredecessors(pathname VARCHAR2) RETURN resid_list_type; |
Retrieves the list of predecessors by path name. |
GetPredsByResId() FUNCTION GetPredsByResId(resid resid_type) RETURN resid_list_type; |
Retrieves the list of predecessors by resource id. |
GetResourceByResId() FUNCTION GetResourceByResId(resid resid_type) RETURN XMLType; |
Obtains the resource as an XMLType , given the resource objectID. |
GetSuccessors() FUNCTION GetSuccessors( pathname VARCHAR2) RETURN resid_list_type; |
Retrieves the list of successors by path name. |
GetSuccsByResId() FUNCTION GetSuccsByResId( resid resid_type) RETURN resid_list_type; |
Retrieves the list of successors by resource id. |
Using DBMS_XDBT
you can set up an Oracle Text ConText
index on the Oracle XML DB repository hierarchy. DBMS_XDBT
creates default preferences and the Oracle Text index. It also sets up automatic synchronization of the ConText
index.
DBMS_XDBT
contains variables that describe the configuration settings for the ConText
index. These are intended to cover the basic customizations that installations may require, but they are not a complete set.
Use DBMS_XDBT
for the following tasks:
To customize the package to set up the appropriate configuration
To drop existing index preferences using dropPreferences(
)
To create new index preferences using createPreferences()
To create the ConText
index using the createIndex()
To set up automatic synchronization of the ConText
index using the configureAutoSync()
Table F-12 summarizes the DBMS_XDBT
functions and procedures.
Table F-12 DBMS_XDBT Functions and Procedures
Procedure/Function | Description |
---|---|
dropPreferences() |
Drops any existing preferences. |
createPreferences() |
Creates preferences required for the ConText index on the XML DB hierarchy. |
createDatastorePref() |
Creates a USER datastore preference for the ConText index. |
createFilterPref() |
Creates a filter preference for the ConText index. |
createLexerPref() |
Creates a lexer preference for the ConText index. |
createWordlistPref() |
Creates a stoplist for the ConText index. |
createStoplistPref() |
Creates a section group for the ConText index. |
createStoragePref() |
Creates a wordlist preference for the ConText index. |
|
Creates a storage preference for the ConText index. |
|
Creates the ConText index on the XML DB hierarchy. |
|
Configures the ConText index for automatic maintenance (SYNC ). |
The following lists the PL/SQL APIs added for this release to load, register schema, and retrieve XML data encoded in different character sets.:
New CreateResource for BFILE and BLOB with csid argument
FUNCTION CreateResource(abspath IN VARCHAR2, data IN BLOB, csid IN NUMBER := 0) RETURN BOOLEAN;
FUNCTION CreateResource(abspath IN VARCHAR2, data IN BFILE, csid IN NUMBER := 0) RETURN BOOLEAN;
New registerSchema
for BLOB
and BFILE
with csid
argument.
procedure registerSchema(schemaURL IN varchar2, schemaDoc IN BLOB, local IN BOOLEAN := TRUE, genTypes IN BOOLEAN := TRUE, genbean IN BOOLEAN := FALSE, genTables IN BOOLEAN := TRUE, force IN BOOLEAN := FALSE, owner IN VARCHAR2 := '', csid IN NUMBER); procedure registerSchema(schemaURL IN varchar2, schemaDoc IN BFILE, local IN BOOLEAN := TRUE, genTypes IN BOOLEAN := TRUE, genbean IN BOOLEAN := FALSE, genTables IN BOOLEAN := TRUE, force IN BOOLEAN := FALSE, owner IN VARCHAR2 := '', csid IN NUMBER);
New getBlob
function with csid
argument.
URIType: MEMBER FUNCTION getBlob(csid IN NUMBER) RETURN blob, FTPURIType: OVERRIDING MEMBER FUNCTION getBlob(csid IN NUMBER) RETURN blob, HttpUriType: OVERRIDING MEMBER FUNCTION getBlob(csid IN NUMBER) RETURN blob, DBURIType: OVERRIDING MEMBER FUNCTION getBlob(csid IN NUMBER) RETURN blob, XDBURIType: OVERRIDING MEMBER FUNCTION getBlob(csid IN NUMBER) RETURN blob,
FUNCTION read2clob(flocation VARCHAR2, fname VARCHAR2, csid IN NUMBER := 0) RETURN CLOB; PROCEDURE clob2file(cl CLOB, flocation VARCHAR2, fname VARCHAR2, csid IN NUMBER := 0);
New XMLType constructors for BLOB and BFILE with csid:
CONSTRUCTOR FUNCTION XMLType(xmlData IN blob, csid IN number, schema IN varchar2 := NULL, validated IN number := 0, wellformed IN number := 0) RETURN self AS result, CONSTRUCTOR FUNCTION XMLType(xmlData IN bfile, csid IN number, schema IN varchar2 := NULL, validated IN number := 0, wellformed IN number := 0) RETURN self AS result,
New createXML methods for BLOB and BFILE with csid.
STATIC FUNCTION createXML(xmlData IN blob, csid IN number, schema IN varchar2, validated IN number := 0, wellformed IN number := 0) RETURN sys.XMLType
STATIC FUNCTION createXML(xmlData IN BFILE, csid IN number, schema IN varchar2, validated IN number := 0, wellformed IN number := 0) RETURN sys.XMLType.
MEMBER FUNCTION getBlobVal(csid IN number) RETURN BLOB