Oracle® XML DB Developer's Guide 10g Release 1 (10.1) Part Number B10790-01 |
|
|
View PDF |
This appendix provides a quick reference for the Oracle XML DB Java application program interfaces (APIs).
This appendix contains these topics:
Java DOM API For XMLType (oracle.xdb and oracle.xdb.dom Classes)
Oracle XML DB Resource API for Java (oracle.xdb.spi Classes)
Packages oracle.xdb
and oracle.xdb.dom
implements the Java Document Object Model (DOM) API for XMLType
. Java DOM API for XMLType
implements the W3C DOM Recommendation Level 1.0 and Level 2.0 Core and also provides Oracle-specific extensions.
Table E-1 lists the Java DOM API for XMLType
(oracle.xdb.dom and oracle.xdb
) classes. Note that class XMLType
is in package oracle.xdb
and not oracle.xdb.dom
.
The following are methods documented in release 2 (9.2.0.1), but not currently supported:
XDBDocument.getElementByID
XDBDocument.importNode
XDBNode.normalize
XDBNode.isSupported
XDBDomImplementation.hasFeature
Table E-1 Java DOM API for XMLType (mostly oracle.xdb.dom) Classes
Java DOM API for XMLType | Description |
---|---|
XDBAttribute |
Implements the W3C DOM Node interface for interacting with XOB s. |
XDBCData |
Implements org.w3c.dom.CData , the W3C text interface. |
XDBCharData |
Implements org.w3c.dom.CharData , the W3C CharacterData interface. |
XDBComment |
Implements the org.w3c.dom.Comment interface. |
XDBDocument |
Implements the org.w3c.dom.Document interface.
Methods:
Parameters: |
XDBDomImplementation |
Implements org.w3c.dom.DomImplementation .
Methods:
|
XDBElement |
Implements org.w3c.dom.Element . |
XDBEntity |
Implements org.w3c.dom.Entity . |
XDBNodeMap |
Implements org.w3c.dom.NamedNodeMap . |
XDBNode |
Implements org.w3c.dom.Node , the W3C DOM Node interface for interacting with XOBs.
Methods:
public void write( OutputStream s, String charEncoding, short indent); Parameters:
|
XDBNodeList |
Implements org.w3c.dom.NodeList . |
XDBNotation |
Implements org.w3c.dom.Notation. |
XDBProcInst |
Implements org.w3c.dom.ProcInst , the W3C DOM ProcessingInstruction interface. |
XDBText |
Implements org.w3c.dom.Text . |
XMLType (package oracle.xdb ) |
Implements Java methods for the SQL type SYS.XMLTYPE . Methods:
|
createXML() |
Creates an XMLType . Throws java.sql.SQLException if the XMLType could not be created:
Parameters:
|
getStringVal() |
Retrieves the string value containing the XML data from the XMLType . Throws java.sql.SQLException.
|
getClobVal() |
Retrieves the CLOB value containing the XML data from the XMLType . Throws java.sql.SQLException
|
getBlobVal() |
Retrieves the BLOB value containing the XML data from the XMLType. Throws java.sql.SQLException.
|
extract() |
Extracts and returns the given set of nodes from the XMLType . The set of nodes is specified by the XPath expression. The original XMLType remains unchanged. Works only in the thick case. If no nodes match the specified expression, returns NULL . Throws java.sql.SQLException
Parameters:
|
existsNode() |
Checks for existence of given set of nodes in the XMLType . This set of nodes is specified by the xpath expression. Returns TRUE if specified nodes exist in the XMLType ; otherwise, returns FALSE . Throws java.sql.SQLException
public boolean existsNode( String xpath, String nsmap); Parameters:
|
transform() |
Transforms and returns the XMLType using the given XSL document. The new (transformed) XML document is returned. Throws java.sql.SQLException.
public Parameters:
|
isFragment() |
Checks if the XMLType is a regular document or document fragment. Returns TRUE if doc is a fragment; otherwise, returns FALSE . Throws java.sql.SQLException.
|
getDOM() |
Retrieves the DOM document associated with the XMLType . This document is the org.w3c.dom.Document. The caller can perform all DOM operations on the Document. If the document is binary, getDOM returns NULL . Throws java.sql.SQLException.
|
Oracle XML DB Resource API for Java's WebDAV support is implemented using package oracle.xdb.spi
classes that
render the service provider interface (SPI) drivers. Classes in oracle.xdb.spi
implement core WebDAV support for Oracle XML DB. Table E-2 lists the oracle.xdb.spi classes.
Table E-2 Oracle XML DB Resource API for Java (oracle.xdb.spi)
The following lists new Java APIs added for Oracle Database 10g release 1(10.1):
Get a Node Value
Writes binary data or character data directly to output stream if csid == 0 then data written as binary, else data written in Oracle specified character set id:public void getNodeValue (java.io.OutputStream, int csid) throws IOException, DOMException;
Writes character data directly into output stream: public void getNodeValue (java.io.Writer) throws java.io.IOException, DOMException;
Reads binary data from node value. If csid == 0, then data returned in binary, else data returned in Oracle specific character set id: public java.io.InputStream getNodeValue (int csid) throws java.io.IOException, DOMException;
Reads node value as character data: public java.io.Reader getNodeValue () throws java.io.IOException, DOMException;
Set a Node Value
Writes binary data or character data directly to node if csid == 0 then data written as binary, else data written in Oracle specified character set id: public java.io.OutputStream setNodeValue ( int csid) throws IOException, DOMException;
Writes character data directly to node: public java.io.Writer setNodeValue () throws IOException, DOMException;
Passes binary or character data. If csid == 0, data is read as binary, else data is read in Oracle specified character set id: public void setNodeValue (java.io.InputStream, int csid) throws IOException, DOMException;
Passes character data: public void setNodeValue (java.io.Reader) throws IOException, DOMException;
Get an Attribute Value
Writes binary or character data directly to output stream, if csid == 0, then binary data is written to output stream, else character data in Oracle specified character set id: public void getValue (java.io.OutputStream value, int csid) throws IOException, SQLException;
Writes character data directly to output stream: public getValue (java.io.Writer value) throws IOException, SQLException;
Reads binary or character data from attribute value. If csid == 0 then data is returned in binary, else data is returned in Oracle specified character set id: public java.io.InputStream getValue (int csid) throws java.io.IOException, SQLException;
Reads character data from attribute value: public java.io.Reader getValue () throws java.io.IOException, SQLException;
Set an Attribute Value
Writes binary or character data directly into attribute if csid == 0 then data is written in binary, else data written in specified Oracle character set id: public java.io.OutputStream setValue ( int csid) throws IOException, DOMException;
Writes character data directly into attribute value: public java.io.Writer setValue () throws IOException, DOMException;
Passes binary or character data to replace attribute value. if csid == 0 data is read as binary, else data is read in specified Oracle character set id: public void setValue (java.io.InputStream int csid) throws IOException, DOMException;
Passes character data to replace attribute value: public void setValue (java.io.Reader) throws IOException, DOMException;
The following lists two new Java XMLType APIs for Oracle Database 10g release 1(10.1):
New XMLType constructor for BLOB with csid argument:
public XMLType (Connection conn, BLOB xmlval, int csid) throws SQLException;
New getBlobVal method with csid argument:
public BLOB getBlobVal(int csid) throws SQLException;
The API s now also cause exceptions in the following cases:
XDBElement.setAttributeNode
- throws DOMException.INUSE_ATTRIBUTE_ERR
if attribute is in use
XDBElement.setAttributeNodeNS
- throws DOMException.INUSE_ATTRIBUTE_ERR
if attribute is in use
XDBNamedNodeMap.setNamedItem
- throws DOMException.INUSE_ATTRIBUTE_ERR
if attribute is in use
XDBNamedNodeMap.setNamedItemNS
- throws DOMException.INUSE_ATTRIBUTE_ERR
if attribute is in use