Oracle® XML Java API Reference
Release 1 (10.1)

B12024-01

oracle.xdb
Class XMLType

java.lang.Object
  |
  +--oracle.sql.Datum
        |
        +--oracle.sql.DatumWithConnection
              |
              +--oracle.sql.OPAQUE
                    |
                    +--oracle.xdb.XMLType
All Implemented Interfaces:
oracle.jdbc.internal.ObjectData, oracle.sql.ORAData

public class XMLType
extends oracle.sql.OPAQUE
implements oracle.sql.ORAData

Field Summary
static java.lang.String _SQL_NAME
           
static int _SQL_TYPECODE
           
static int CONNTYPE_KPRB
           
static int CONNTYPE_OCI8
           
static int CONNTYPE_THIN
           

 

Fields inherited from class oracle.sql.OPAQUE
BUILD_DATE, PRIVATE_TRACE, TRACE

 

Constructor Summary
XMLType()
          NOTE - Applications should not use the default constructor, this function is for internal use only.
XMLType(java.sql.Connection conn, oracle.sql.BLOB xmlval, int csid)
          Construct an XMLType given a BLOB containing the XML data
XMLType(java.sql.Connection conn, oracle.sql.CLOB xmlval)
          Construct an XMLType given a CLOB containing the XML data
XMLType(java.sql.Connection conn, oracle.sql.CLOB xmlval, java.lang.String schemaURL, boolean wellformed, boolean valid)
          Construct an XMLType given a CLOB containing the XML data
XMLType(java.sql.Connection conn, Document domdoc)
          Constructor to create an XMLType given an instance of the DOM document
XMLType(java.sql.Connection conn, java.io.InputStream is)
          Construct an XMLType given a InputStream containing the XML data.
XMLType(java.sql.Connection conn, java.lang.String xmlval)
          Construct an XMLType given the string containing the XML data
XMLType(java.sql.Connection conn, java.lang.String xmlval, java.lang.String schemaURL, boolean wellformed, boolean valid)
          Construct an XMLType given the string containing the XML data
XMLType(oracle.sql.OpaqueDescriptor type, java.sql.Connection conn, java.lang.Object value)
          Create an XMLType given an opaque descriptor, connection and a pickled image.

 

Method Summary
 void close()
          Function to free/close the XMLType.
 XMLType createSchemaBasedXML(java.lang.String schemaURL)
          Create a schema-based XML
static XMLType createXML(java.sql.Connection conn, oracle.sql.CLOB xmlval)
          Create an XMLType given a CLOB containing the XML data
static XMLType createXML(java.sql.Connection conn, oracle.sql.CLOB xmlval, java.lang.String schemaURL, boolean wellformed, boolean valid)
          Create an XMLType given a CLOB containing the XML data
static XMLType createXML(java.sql.Connection conn, Document domdoc)
          Create an XMLType given an instance of the DOM document
static XMLType createXML(java.sql.Connection conn, java.io.InputStream is)
          Create an XMLType given a InputStream containing the XML data.
static XMLType createXML(java.sql.Connection conn, java.lang.String xmlval)
          Create an XMLType given the string containing the XML data
static XMLType createXML(java.sql.Connection conn, java.lang.String xmlval, java.lang.String schemaURL, boolean wellformed, boolean valid)
          Create an XMLType given the string containing the XML data
static XMLType createXML(oracle.sql.OPAQUE opq)
          Create an XMLType given the opaque type containing the XMLType bytes
 boolean existsNode(java.lang.String xpath, java.lang.String nsmap)
          Function to check for the existence of the given set of nodes in the XMLType.
 XMLType extract(java.lang.String xpath, java.lang.String nsmap)
          Function to extract the given set of nodes from the XMLType.
 void finalize()
          Finalize does nothing, use close().
 oracle.sql.BLOB getBlobVal(int csid)
          Get the BLOB value containing the XML data from the XMLType.
 byte[] getBytesValue()
          NOTE - this function is for internal use only.
 oracle.sql.CLOB getClobVal()
          Get the CLOB value containing the XML data from the XMLType.
static int getConnType(java.sql.Connection conn)
           
 XDBDocFragment getDocumentFragment()
          Function to return XDBDocFragment if XMLType instance is a fragment
 Document getDOM()
          Gets the DOM document associated with the XMLType.
static long getErrorHandle(java.sql.Connection conn, int conntype)
           
 java.io.InputStream getInputStream()
          Get an InputStream from the XMLType, applications can read XML data from the stream
 java.lang.String getNamespace()
          return the default namespace of the XMLType document
 oracle.sql.NUMBER getNumberVal()
          Return the numeric value of the XML document
static oracle.sql.ORADataFactory getORADataFactory()
          NOTE - Internal function, not to be used by applications Get the oradata factory for this XMLType.
 java.lang.String getRootElement()
          Return the root element name
 java.lang.String getSchemaURL()
          Return the schema URL (i.e. location of the schema to which this XMLType conforms)
static long getServiceHandle(java.sql.Connection conn, int conntype)
           
 java.lang.String getStringVal()
          Get the string value containing the XML data from the XMLType.
 boolean isFragment()
          Function to check if the XMLType is a regular document or a document fragment.
 boolean isSchemaBased()
          Function to check if the XMLType is schema based.
 boolean isSchemaValid(java.lang.String schurl, java.lang.String elname)
          Function to check if the XMLType is schema based.
 boolean isSchemaValidated()
          Return TRUE if the document has been validated against its schema
 void schemaValidate()
          Validate the schema-based document against its own schema.
 void setSchemaValidated(boolean validateFlag)
          This function sets the VALIDATED flag to indicate that the XMLType has been validated or not.
 byte[] toBytes()
          NOTE - this function is for internal use only.
 oracle.sql.Datum toDatum(java.sql.Connection conn)
          NOTE - Internal function, not to be used by applications Construct an image from the XMLType data.
 XMLType transform(XMLType xsldoc, java.lang.String parammap)
          Function to transform the XMLType using the given XSL document.
 void writeToOutputStream(java.io.OutputStream os)
          Write the contents of the XMLType to an OutputStream

 

Methods inherited from class oracle.sql.OPAQUE
getDescriptor, getImageLength, getImageOffset, getJavaSqlConnection, getMap, getSQLTypeName, getValue, isConvertibleTo, makeJdbcArray, setDescriptor, setImage, setImageLength, setValue, toClass, toClass, toJdbc, toJdbc

 

Methods inherited from class oracle.sql.DatumWithConnection
assertNotNull, assertNotNull, getConnection, getInternalConnection, getOracleConnection, setPhysicalConnectionOf

 

Methods inherited from class oracle.sql.Datum
asciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, byteValue, characterStreamValue, compareBytes, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, longValue, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timeValue

 

Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Field Detail

_SQL_TYPECODE

public static final int _SQL_TYPECODE
See Also:
Constant Field Values

_SQL_NAME

public static final java.lang.String _SQL_NAME
See Also:
Constant Field Values

CONNTYPE_THIN

public static final int CONNTYPE_THIN
See Also:
Constant Field Values

CONNTYPE_OCI8

public static final int CONNTYPE_OCI8
See Also:
Constant Field Values

CONNTYPE_KPRB

public static final int CONNTYPE_KPRB
See Also:
Constant Field Values
Constructor Detail

XMLType

public XMLType(java.sql.Connection conn,
               java.lang.String xmlval)
        throws java.sql.SQLException
Construct an XMLType given the string containing the XML data
Parameters:
conn - the connection object to be used.
xmlval - the string containing the XML data
Throws:
java.sql.SQLException

XMLType

public XMLType(java.sql.Connection conn,
               java.lang.String xmlval,
               java.lang.String schemaURL,
               boolean wellformed,
               boolean valid)
        throws java.sql.SQLException
Construct an XMLType given the string containing the XML data
Parameters:
conn - the connection object to be used.
xmlval - the string containing the XML data
schemaURL - the schema URL for the XMLType
wellformed - XML document is well-formed
valid - XML document is valid
Throws:
java.sql.SQLException

XMLType

public XMLType(java.sql.Connection conn,
               oracle.sql.CLOB xmlval)
        throws java.sql.SQLException
Construct an XMLType given a CLOB containing the XML data
Parameters:
conn - the connection object to be used.
xmlval - the CLOB containing the XML data
Throws:
java.sql.SQLException

XMLType

public XMLType(java.sql.Connection conn,
               oracle.sql.CLOB xmlval,
               java.lang.String schemaURL,
               boolean wellformed,
               boolean valid)
        throws java.sql.SQLException
Construct an XMLType given a CLOB containing the XML data
Parameters:
conn - the connection object to be used.
xmlval - the CLOB containing the XML data
schemaURL - the schema URL for the XMLType
wellformed - XML document is well-formed
valid - XML document is valid
Throws:
java.sql.SQLException

XMLType

public XMLType(java.sql.Connection conn,
               oracle.sql.BLOB xmlval,
               int csid)
        throws java.sql.SQLException
Construct an XMLType given a BLOB containing the XML data
Parameters:
conn - the connection object to be used.
xmlval - the BLOB containing the XML data
Throws:
java.sql.SQLException

XMLType

public XMLType(java.sql.Connection conn,
               java.io.InputStream is)
        throws java.sql.SQLException
Construct an XMLType given a InputStream containing the XML data. Note: This takes the bytes "as is" and puts them into the server. Data must be in the database characterset.
Throws:
java.sql.SQLException

XMLType

public XMLType(oracle.sql.OpaqueDescriptor type,
               java.sql.Connection conn,
               java.lang.Object value)
        throws java.sql.SQLException
Create an XMLType given an opaque descriptor, connection and a pickled image.
Parameters:
type - the opaque type descriptor to be used.
conn - the connection object to be used.
value - the pickled image bytes.
Throws:
java.sql.SQLException

XMLType

public XMLType(java.sql.Connection conn,
Document domdoc)
        throws java.sql.SQLException
Constructor to create an XMLType given an instance of the DOM document
Parameters:
domdoc - the DOM Document which represents the DOM tree
Throws:
java.sql.SQLException

XMLType

public XMLType()
        throws java.sql.SQLException
NOTE - Applications should not use the default constructor, this function is for internal use only.
Method Detail

getORADataFactory

public static oracle.sql.ORADataFactory getORADataFactory()
NOTE - Internal function, not to be used by applications Get the oradata factory for this XMLType. This is a 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
NOTE - Internal function, not to be used by applications Construct an image from the XMLType data. This function pickles the XMLType bytes and returns the bytes as a Datum
Specified by:
toDatum in interface oracle.sql.ORAData
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,
                                java.lang.String xmlval,
                                java.lang.String schemaURL,
                                boolean wellformed,
                                boolean valid)
                         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
schemaURL - the schema URL for the XMLType
wellformed - XML document is well-formed
valid - XML document is valid
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

createXML

public static XMLType createXML(java.sql.Connection conn,
                                oracle.sql.CLOB xmlval,
                                java.lang.String schemaURL,
                                boolean wellformed,
                                boolean valid)
                         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
schemaURL - the schema URL for the XMLType
wellformed - XML document is well-formed
valid - XML document is valid
Returns:
the created XMLType
Throws:
java.sql.SQLException

createXML

public static XMLType createXML(java.sql.Connection conn,
                                java.io.InputStream is)
                         throws java.sql.SQLException
Create an XMLType given a InputStream containing the XML data. Note: This takes the bytes from the InputStream "as is", and sends them into the server. This assumes data is in the database characterset.
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

getBlobVal

public oracle.sql.BLOB getBlobVal(int csid)
                           throws java.sql.SQLException
Get the BLOB value containing the XML data from the XMLType.
Returns:
the BLOB containing the XML data bytes.
Throws:
java.sql.SQLException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.sql.SQLException
Get an InputStream from the XMLType, applications can read XML data from the stream
Returns:
the InputStream for the XMLType
java.sql.SQLException

writeToOutputStream

public void writeToOutputStream(java.io.OutputStream os)
                         throws java.sql.SQLException
Write the contents of the XMLType to an OutputStream
java.sql.SQLException

createXML

public static XMLType createXML(java.sql.Connection conn,
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.
java.sql.SQLException

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
java.sql.SQLException

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
java.sql.SQLException

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
java.sql.SQLException

getDocumentFragment

public XDBDocFragment getDocumentFragment()
                                   throws java.sql.SQLException
Function to return XDBDocFragment if XMLType instance is a fragment
Returns:
XDDBDocFragment if XMLType instance is a fragment, else null
java.sql.SQLException

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
java.sql.SQLException

createSchemaBasedXML

public XMLType createSchemaBasedXML(java.lang.String schemaURL)
                             throws java.sql.SQLException
Create a schema-based XML
Returns:
an XMLType object based on the given schema
java.sql.SQLException

getRootElement

public java.lang.String getRootElement()
                                throws java.sql.SQLException
Return the root element name
Returns:
the root element name
java.sql.SQLException

getSchemaURL

public java.lang.String getSchemaURL()
                              throws java.sql.SQLException
Return the schema URL (i.e. location of the schema to which this XMLType conforms)
Returns:
the schema URL
java.sql.SQLException

isSchemaBased

public boolean isSchemaBased()
                      throws java.sql.SQLException
Function to check if the XMLType is schema based.
Returns:
TRUE if doc is schema based else FALSE
java.sql.SQLException

getNamespace

public java.lang.String getNamespace()
                              throws java.sql.SQLException
return the default namespace of the XMLType document
Returns:
the namespace of the XMLType document
java.sql.SQLException

schemaValidate

public void schemaValidate()
                    throws java.sql.SQLException
Validate the schema-based document against its own schema.
java.sql.SQLException

isSchemaValidated

public boolean isSchemaValidated()
                          throws java.sql.SQLException
Return TRUE if the document has been validated against its schema
Returns:
TRUE if the document has been validated against its schema
java.sql.SQLException

setSchemaValidated

public void setSchemaValidated(boolean validateFlag)
                        throws java.sql.SQLException
This function sets the VALIDATED flag to indicate that the XMLType has been validated or not.
Parameters:
validateFlag -
java.sql.SQLException

getNumberVal

public oracle.sql.NUMBER getNumberVal()
                               throws java.sql.SQLException
Return the numeric value of the XML document
Returns:
the numeric value of the XML document
java.sql.SQLException

getDOM

public 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
java.sql.SQLException
See Also:
Document

getBytesValue

public byte[] getBytesValue()
                     throws java.sql.SQLException
NOTE - this function is for internal use only. Function to return the OPAQUE bytes for the XMLType.
Overrides:
getBytesValue in class oracle.sql.OPAQUE
java.sql.SQLException

getErrorHandle

public static long getErrorHandle(java.sql.Connection conn,
                                  int conntype)
                           throws java.sql.SQLException
java.sql.SQLException

getServiceHandle

public static long getServiceHandle(java.sql.Connection conn,
                                    int conntype)
                             throws java.sql.SQLException
java.sql.SQLException

toBytes

public byte[] toBytes()
               throws java.sql.SQLException
NOTE - this function is for internal use only. Function to return the OPAQUE bytes for the XMLType.
Overrides:
toBytes in class oracle.sql.OPAQUE
java.sql.SQLException

close

public void close()
Function to free/close the XMLType. Any operation after this will result in a SQLException. Applications need to call close else a memory leak will result.

finalize

public void finalize()
Finalize does nothing, use close().
Overrides:
finalize in class java.lang.Object

getConnType

public static int getConnType(java.sql.Connection conn)
                       throws java.sql.SQLException
java.sql.SQLException

Oracle® XML Java API Reference
Release 1 (10.1)

B12024-01

Copyright © 2003, Oracle. All Rights Reserved.