Skip Headers

Oracle9i Supplied Java Packages Reference
Release 2 (9.2)

Part Number A96609-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

22
Package oracle.xdb.dom

The classes described in this chapter are contained in package oracle.xdb.dom and implement the Java DOM API for XMLType.

This chapter contains these sections:


Package oracle.xdb.dom Description

The classes described in this chapter implement the Java DOM API for XMLType and are contained in package oracle.xdb.dom. Oracle XML DB supports the Document Object Model (DOM) as set forth by the W3C DOM Recommendation. For more information about the DOM, refer to http://www.w3.org/DOM/.

See Also:

For more information about developing applications using the features of Oracle XML DB, see Oracle9i XML Database Developer's Guide - Oracle XML DB

In addition to implementing the W3C DOM Recommendation, the DOM API for Oracle XML DB provides Oracle-specific extensions.


Package oracle.xdb.dom Class Summary

Table 22-1 Classes in oracle.xdb.dom
Class Description

XDBAttribute Class

Implements the W3C DOM Node interface for interacting with XOBs.

XDBCData Class

Implements the W3C text interface.

XDBCharData Class

Implementsthe W3C CharacterData interface

XDBComment Class

Implements the W3C Comment interface.

XDBDocument Class

Implements the W3C Document interface.

XDBDomImplementation Class

Implements the W3C DomImplementation interface, which opens a JDBC connection to the server.

XDBElement Class

Implements the W3C Element interface.

XDBNamedNodeMap Class

Implements the W3C Named Node Map interface.

XDBNode Class

Implements the W3C Node interface.

XDBNodeList Class

Implements the W3C Node List interface.

XDBProcInst Class

Implements the W3C the W3C DOM ProcessingInstruction interface.

XDBText Class

Implements the W3C Text interface.

XMLType Class

Implements the native datatype XMLType in Oracle XML DB.

Table 22-2  Classes in oracle.xdb.dom mapped to org.w3c.dom Implementation
Class Implements

XDBAttribute Class

org.w3c.dom.Attribute

XDBCData Class

org.w3c.dom.CData

XDBCharData Class

org.w3c.dom.CharData

XDBComment Class

org.w3c.dom.Comment

XDBDocument Class

org.w3c.dom.Document

XDBDomImplementation Class

org.w3c.dom.DomImplementation

XDBElement Class

org.w3c.dom.Element

XDBNamedNodeMap Class

org.w3c.dom.NamedNodeMap

XDBNode Class

org.w3c.dom.Node

XDBNodeList Class

org.w3c.dom.NodeList

XDBProcInst Class

org.w3c.dom.ProcInst

XDBText Class

org.w3c.dom.Text

XMLType Class

N/a. This class is specific to Oracle.


XDBAttribute Class

Syntax

public class XDBAttribute
 
oracle.xdb.dom.XDBAttribute

Description

This class implements org.w3c.dom.Attribute, the W3C DOM Node interface for interacting with XOBs.


XDBCData Class

Syntax

public class XDBCData
 
oracle.xdb.dom.XDBCData

Description

This class implements org.w3c.dom.CData, the W3C text interface.


XDBCharData Class

Syntax

public class XDBCharData
 
oracle.xdb.dom.XDBCharData

Description

This class implements org.w3c.dom.CharData, the W3C CharacterData interface.


XDBComment Class

Syntax

public class XDBComment
 
oracle.xdb.dom.XDBComment

Description

This class implements the org.w3c.dom.Comment interface.


XDBDocument Class

Syntax

public class XDBDocument
 
oracle.xdb.dom.XDBDocument

Description

This class implements the org.w3c.dom.Document interface.


Methods

XDBDocument()

Syntax

public  XDBDocument()

Description

Creates new Document. Can be used in server only.

XDBDocument(byte[ ])

Syntax

public  XDBDocument(byte[] source)

Description

Populates Document from source. Can be used in server only.

Parameters

source - Bytes containing XML text.

XDBDocument(Connection)

Syntax

public  XDBDocument(java.sql.Connection conn)

Description

Opens connection for caching Document source.

Parameters

conn - Connection to be used for Document.

XDBDocument(Connection, byte[ ])

Syntax

public  XDBDocument(java.sql.Connection conn, byte[] source)

Description

Connection for caching bytes for Document source.

Parameters

conn - Connection to be used for Document.

source - Bytes containing XML text.

XDBDocument(Connection, String)

Syntax

public  XDBDocument(java.sql.Connection conn, java.lang.String source)

Description

Opens connection for caching string containing XML text.

Parameters

source - String containing XML text.

conn - Connection to be used for String.

XDBDocument(String)

Syntax

public  XDBDocument(java.lang.String source)

Description

String containing XML text. Can be used in server only.


XDBDomImplementation Class

Syntax

public class XDBDomImplementation
 
oracle.xdb.dom.XDBDomImplementation

Description

This class implements org.w3c.dom.DomImplementation.


Methods

XDBDomImplementation()

Syntax

public  XDBDomImplementation()

Description

Opens a JDBC connection to the server.


XDBElement Class

Syntax

public class XDBElement
 
oracle.xdb.dom.XDBElement

Description

This class implements org.w3c.dom.Element.


XDBNamedNodeMap Class

Syntax

public class XDBNamedNodeMap
 
oracle.xdb.dom.XDBNamedNodeMap

Description

This class implements org.w3c.dom.NamedNodeMap.


XDBNode Class

Syntax

public abstract class XDBNode
 
oracle.xdb.dom.XDBNode

Description

This class implements org.w3c.dom.Node, the W3C DOM Node interface for interacting with XOBs.


Methods

write(OutputStream, String, short)

Description

Writes the XML for this Node (and all subnodes) to an OutputStream. If the OutputStream is a ServletOutputStream, the servlet output is committed and the data is written using a native stream mechanism.

Syntax

public void write(java.io.OutputStream s, java.lang.String charEncoding, short 
indent)

Parameters

s - The stream to write the output to

charEncoding - The IANA char code (e.g. "ISO-8859")

indent - Number of chars to indent nested elements


XDBNodeList Class

Syntax

public class XDBNodeList
 
oracle.xdb.dom.XDBNodeList

Description

This class implements org.w3c.dom.NodeList.


XDBProcInst Class

Syntax

public class XDBProcInst
 
oracle.xdb.dom.XDBProcInst

Description

This class implements org.w3c.dom.ProcInst, the W3C DOM ProcessingInstruction interface.


XDBText Class

Syntax

public class XDBText
 
oracle.xdb.dom.XDBText

Description

This class implements org.w3c.dom.Text.


XMLType Class

oracle.xdb.XMLType

public class XMLType

Description

XMLType class implements the native datatype XMLType in Oracle XML DB, which supports storage and manipulation of XML in the server. Multiple storage options including structured XML and Character Large Object (CLOB) are available with XMLType.

The native structured XML storage is a decomposition of XML into underlying object-relational structures (automatically created and managed by Oracle) for better SQL queriability. CLOB storage is an un-decomposed storage that retains an image of the original XML, including white space.


Fields

Table 22-3 Field Summary for XMLType Class
Field Description

SQL_TYPECODE

static int

SQL_TYPENAME

static java.lang.String

_SQL_TYPECODE

public static final int _SQL_TYPECODE

_SQL_TYPENAME

public static final java.lang.String _SQL_TYPENAME


Constructors

XMLType

public XMLType()
       throws java.sql.SQLException

Methods

Table 22-4  Method Summary for XMLType
Method Description

getORADataFactory

Get the oradata factory for this XMLType.

toDatum

Construct an image from the XMLType data.

createXML

Create an XMLType given a connection (conn) and the specified datatype and object.

getStringVal

Get the string value containing the XML data from the XMLType.

getClobVal

Get the CLOB value containing the XML data from the XMLType.

extract

Function to extract the given set of nodes from the XMLType.

existsNode

Function to check for the existence of the given set of nodes in the XMLType.

transform

Function to transform the XMLType using the given XSL document.

isFragment

Function to check if the XMLType is a regular document or a document fragment.

isSchemaValid

Function to check if the XMLType is schema based.

getDOM

Gets the DOM document associated with the XMLType.

getBytesValue

Gets the bytes value containing the XML data from the XMLType.

getORADataFactory

public static oracle.sql.ORADataFactory getORADataFactory()

Get the oradata factory for this XMLType. This is required as part of the oradata interface

Returns

the ORADataFactory assoicated with this XMLType.

toDatum

public oracle.sql.Datum toDatum(java.sql.Connection conn)
                         throws java.sql.SQLException

Construct an image from the XMLType data. This function pickles the XMLType bytes and returns the bytes as a Datum.

Parameters

conn - the connection to be used for Datum creation

Returns

the pickled image

Throws

java.sql.SQLException -

createXML

public static XMLType createXML(oracle.sql.OPAQUE opq)
                         throws java.sql.SQLException

Create an XMLType given the opaque type containing the XMLType bytes

Parameters

opq - the opaque data object from which the XMLType is to be generated

Returns

the created XMLType

Throws

java.sql.SQLException -

createXML

public static XMLType createXML(java.sql.Connection conn,
                                java.lang.String xmlval)
                         throws java.sql.SQLException

Create an XMLType given the string containing the XML data

Parameters

conn - the connection object to be used.

xmlval - the string containing the XML data

Returns

the created XMLType

Throws

java.sql.SQLException -

createXML

public static XMLType createXML(java.sql.Connection conn,
                                oracle.sql.CLOB xmlval)
                         throws java.sql.SQLException

Create an XMLType given a CLOB containing the XML data

Parameters

conn - the connection object to be used.

xmlval - the CLOB containing the XML data

Returns

the created XMLType

Throws

java.sql.SQLException

getStringVal

public java.lang.String getStringVal()
                              throws java.sql.SQLException

Get the string value containing the XML data from the XMLType.

Returns

the string containing the XML data bytes.

Throws

java.sql.SQLException -

getClobVal

public oracle.sql.CLOB getClobVal()
                           throws java.sql.SQLException

Get the CLOB value containing the XML data from the XMLType.

Returns

the CLOB containing the XML data bytes.

Throws

java.sql.SQLException -

createXML

public static XMLType createXML(java.sql.Connection conn,
                                org.w3c.dom.Document domdoc)
                         throws java.sql.SQLException

Create an XMLType given an instance of the DOM document

Parameters

domdoc - the DOM Document which represents the DOM tree

Returns

the constructed XMLType.

Throws

java.sql.SQLException -

extract

public XMLType extract(java.lang.String xpath,
                       java.lang.String nsmap)
                 throws java.sql.SQLException

Function to extract the given set of nodes from the XMLType. This set of nodes is specified by the XPath expression. The original XMLType remains unchanged. Works only in the thick case.

Parameters

xpath - the xpath expression which specifies the nodes to search for.

nsmap - the map of namespaces which resolves the prefixes in the xpath expression. format is "xmlns=a.com xmlns:b=b.com"

Returns

XMLType which contains the extracted nodes. null if no nodes match the specified expression.

existsNode

public boolean existsNode(java.lang.String xpath,
                          java.lang.String nsmap)
                   throws java.sql.SQLException

Function to check for the existence of the given set of nodes in the XMLType. This set of nodes is specified by the xpath expression.

Parameters

xpath - the xpath expression which specifies the nodes to search for.

nsmap - the map of namespaces which resolves the prefixes in the xpath expression. format is "xmlns=a.com xmlns:b=b.com"

Returns

TRUE if specified nodes exist in the XMLType else FALSE

transform

public XMLType transform(XMLType xsldoc,
                         java.lang.String parammap)
                  throws java.sql.SQLException

Function to transform the XMLType using the given XSL document. The new (transformed) XML document is returned.

Parameters

xsldoc - the XSL document to be applied to the XMLType

parammap - the top level parameters to be passed to the XSL transformation. This should be of the format "a=b c=d e=f". This can be null.

Returns

the transformed XMLType

isFragment

public boolean isFragment()
                   throws java.sql.SQLException

Function to check if the XMLType is a regular document or a document fragment.

Returns

TRUE if doc is a fragment else FALSE

isSchemaValid

public boolean isSchemaValid(java.lang.String schurl,
                             java.lang.String elname)
                    throws java.sql.SQLException

Function to check if the XMLType is schema based.

Parameters

schurl - the URL of the schema to be validated against; if this is null then the documents own schema URL is used (if one exists).

Returns

TRUE if doc is schema based else FALSE

getDOM

public org.w3c.dom.Document getDOM()
                            throws java.sql.SQLException

Gets the DOM document associated with the XMLType. This document is the org.w3c.dom.Document. The caller can perform all the DOM operations on the Document. If the document is a binary document the getDOM function will return null.

Returns

the DOM Document object associated with the XMLType

getBytesValue

public byte[] getBytesValue()
                     throws java.sql.SQLException

Gets the bytes value containing the XML data from the XMLType.


Go to previous page Go to next page
Oracle
Copyright © 1996, 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