Skip Headers

Oracle9i XML Database Developer's Guide - Oracle XML DB
Release 2 (9.2)

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

E
Java DOM and Java Bean API for XMLType, Resource API for Java/JNDI: Quick Reference

This appendix contains a quick reference for the following Oracle XML DB Java APIs:

Java DOM API For XMLType

Packages oracle.xdb and oracle.xdb.dom implements the Java 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.

See Also:
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 XOBs.

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:

XDBDocument() constructor:

XDBDocument();Creates new Document. Can be used in server only.

XDBDocument( byte[ ] source);Populates Document from source. Can be used in server only.

XDBDocument( Connection conn);Opens connection for caching Document source.

XDBDocument( Connection conn, byte[] source); Connection for caching bytes for Document source.

XDBDocument( Connection conn, String source);Opens connection for caching string containing XML text.

XDBDocument(String source);The string containing XML text. Can be used in server only.

Parameters: source - Contains XML text., conn -Connection to be used.

XDBDomImplementation

Implements org.w3c.dom.DomImplementation.

Methods:

XDBDomImplementation()- Opens a JDBC connection to the server.

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:

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

public void write( OutputStream s, String charEncoding, short indent);

Parameters:

s - stream to write the output toContains XML text

charEncoding - IANA char code (for example, "ISO-8859")

indent - number of characters to indent nested elements

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. Use this method when accessing data through JDBC.

getStringVal() - Retrieves string value containing the XML data from the XMLType

getClobVal() - Retrieves the CLOB value containing the XML data from the XMLType

extract() - Extracts the given set of nodes from the XMLType

existsNode() - Checks for the existence of the given set of nodes in the XMLType

transform() - Transforms the XMLType using the given XSL document

isFragment() - Checks if the XMLType is a regular document or a document fragment

getDOM() - Retrieves the DOM document associated with the XMLType.

createXML()

Creates an XMLType. Throws java.sql.SQLException if the XMLType could not be created:

public static XMLType createXML( OPAQUE opq); Creates and returns an XMLType given the opaque type containing the XMLType bytes.

public static XMLType createXML(Connection conn, String xmlval); Creates and returns an XMLType given the string containing the XML data.

public static XMLType createXML( Connection conn, CLOB xmlval); Creates and returns an XMLType given a CLOB containing the XML data.

public static XMLType createXML(Connection conn, Document domdoc); Creates and returns an XMLType given an instance of the DOM document.

Parameters:

opq - opaque object from which the XMLType is to be constructed

conn - connection object to be used, xmlval - contains the XML data

domdoc - the DOM Document which represents the DOM tree,

getStringVal()

Retrieves the string value containing the XML data from the XMLType. Throws java.sql.SQLException.

public String getStringVal();

getClobVal()

Retrieves the CLOB value containing the XML data from the XMLType. Throws java.sql.SQLException

public CLOB getClobVal();

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

public XMLType extract( String xpath, String nsmap);

Parameters:

xpath - xpath expression which specifies for which nodes to search

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

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:

xpath - xpath expression that specifies for which nodes to search

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

transform()

Transforms and returns the XMLType using the given XSL document. The new (transformed) XML document is returned. Throws java.sql.SQLException.

public XMLType transform( XMLType xsldoc, String parammap);

Parameters:

xsldoc - The XSL document to be applied to the XMLType

parammap - top level parameters to be passed to the XSL transformation. Use format "a=b c=d e=f". Can be NULL.

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.

public boolean isFragment();

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.

public org.w3c.dom.Document getDOM();

Java Bean API for XMLType

The package oracle.xdb.bean implements the Java Bean API for XMLType. It maps between XML schema and SQL and Java entities and datatypes, and Java Bean classes.

Table E-2 lists the mapping from XML schema entities to Java Bean classes and methods.

See Also:

Chapter 9, "Java and Java Bean APIs for XMLType"

Table E-2 Mapping From XML Schema Entities to Java Bean Classes  
XML Schema Entity Java Bean Class Description

Attribute

Get/setAttribute{attrname}

Gets/sets the attribute for the document child element and its specified attribute.

Complextype

Get/set{complextype classname}.

For complex children, separate bean classes get generated. Extras (processing instructions or comments). DOM classes for processing instructions and comments are returned.

Scalar data

Get/set{scalar type name}

Children with maxoccurs > 1 Get/set List of type of child.

Table E-3 lists the mapping used by the Java Bean API for XMLType between XML Schema, SQL, and Java datatypes.

Table E-3 Mapping From XML Schema to SQL and Java Datatypes  
XML Schema Datatype SQL Datatype Java Bean Datatype

Boolean

boolean

boolean

String

URI reference

ID

IDREF

ENTITY

NOTATION

Language

NCName

Name

java.lang.String

String

DECIMAL

INTEGER

LONG

SHORT

INT

POSITIVEINTEGER

NONPOSITIVEINTEGER

oracle.sql.Number

int

FLOAT

DOUBLE

oracle.sql.Number

float

TIMEDURATION

TIMEPERIOD

RECURRINGDURATION

DATE

TIME

MONTH,YEAR

RECURRINGDATE

java.sql.Timestamp

Time

REF

oracle.sql.Ref

Ref

BINARY

oracle.sql.RAW

Byte[]

QNAME

java.lang.String

String

Oracle XML DB Resource API for Java/JNDI

Oracle XML DB Resource API for Java/JNDI is implemented using package oracle.xdb.spi classes that render the service provider interface (SPI) drivers. These provide the application with common access to Java Naming and Directory Interface (JNDI).

Classes in oracle.xdb.spi implement core JNDI SPI interfaces and WebDAV support for Oracle XML DB. Table E-4 lists the oracle.xdb.spi classes.

See Also:

Chapter 17, "Oracle XML DB Resource API for Java/JNDI"

Table E-4 Oracle XML DB Resource API for Java/JNDI (oracle.xdb.spi)  
oracle.xdb.spi Class Description

XDBContext Class

Implements the Java naming and context interface for Oracle XML DB, which extends javax.naming.context. In this release there is no federation support, in other words, it is completely unaware of the existence of other namespaces. Methods:

XDBContext() - Class XDBContext constructor.

  • public XDBContext( Hashtable env); Creates an instance of XDBContext class given the environment.
  • public XDBContext( Hashtable env, String path); Creates an instance of XDBContext class given the environment and path.

Parameters: env - Environment to describe properties of context, path - Initial path for the context.

XDBContextFactory Class

Implements javax.naming.context.

Methods:

XDBContextFactory() - Constructor for class XDBContextFactory. public XDBContextFactory();

XDBNameParser Class

Implements javax.naming.NameParser

XDBNamingEnumeration Class

Implements javax.naming.NamingEnumeration

XDBResource Class

Implements the core features for Oracle XML DB JNDI service provider interface (SPI). This release has no federation support, and is unaware of the existence of other namespaces. public class XDBResource extends java.lang.Object.

Methods:

XDBResource()- Creates a new instance of XDBResource

getAuthor() - Returns author of the resource

getComment() - Returns the DAV comment of the resource

getContent() - Returns the content of the resource

getContentType() - Returns the content type of the resource

getCreateDate() - Returns the create date of the resource

getDisplayName() - Returns the display name of the resource

getLanguage() - Returns the language of the resource

getLastModDate() - Returns the last modification date of the resource

getOwnerId() - Returns the owner ID of the resource

setACL() - Sets the ACL on the resource

setAuthor() - Sets the author of the resource

setComment() - Sets the DAV comment of the resource

setContent() - Sets the content of the resource

setContentType() - Sets the content type of the resource

setCreateDate() - Sets the creation date of the resource

setDisplayName() - Sets the display name of the resource

setLanguage() - Sets the language of the resource

setLastModDate() - Sets the last modification date of the resource

setOwnerId() -Sets the owner ID of the resource

XDBResource()

Creates a new instance of XDBResource. public Creates a new instance of XDBResource given the environment.

public XDBResource( Hashtable env, String path); Creates a new instance of XDBResource given the environment and path.

Parameters: env - Environment passed in, path - Path to the resource

getAuthor()

Retrieves the author of the resource.

public String getAuthor();

getComment()

Retrieves the DAV (Web Distributed Authoring and Versioning) comment of the resource.

public String getComment();

getContent()

Returns the content of the resource.

public Object getContent();

getContentType()

Returns the content type of the resource. public String getContentType();

getCreateDate()

Returns the creation date of the resource. public Date getCreateDate();

getDisplayName()

Returns the display name of the resource. public String getDisplayName();

getLanguage()

Returns the Language of the resource. public String getLanguage();

getLastModDate()

Returns the last modification date of the resource.

public Date getLastModDate();

getOwnerId()

Returns the owner id of the resource. The value expected by this method is the user id value for the database user as provided by the catalog views such as ALL_USERS, and so on.

public long getOwnerId();

setACL()

Sets the ACL on the resource.

public void setACL( String aclpath);

Parametes: aclpath - The path to the ACL resource.

setAuthor()

Sets the author of the resource. public void setAuthor( String authname); Parameter: authname - Author of the resource.

setComment()

Sets the DAV (Web Distributed Authoring and Versioning) comment of the resource.

public void setComment(String davcom); Parameter: davcom - DAV comment of the resource.

setContent()

Sets the content of the resource.

public void setContent( Object xmlobj); Parameter: xmlobj - Content of the resource.

setContentType()

Sets the content type of the resource.

public void setContentType( String conttype);

Parameter: conttype - Content type of the resource.

setCreateDate()

Sets the creation date of the resource.

public void setCreateDate( Date credate);

Parameter: credate - Creation date of the resource.

setDisplayName()

Sets the display name of the resource.

public void setDisplayName( String dname);

Parameter: dname - Display name of the resource.

setLanguage()

Sets the language of the resource.

public void setLanguage(String lang);

Parameter: lang - Language of the resource.

setLastModDate()

Sets the last modification date of the resource.

public void - setLastModDate( Date d);

Parameter: d - Last modification date of the resource.

setOwnerId()

Sets the owner id of the resource. The owner id value expected by this method is the user id value for the database user as provided by the catalog views such as ALL_USERS, and so on.

public void setOwnerId( long ownerid);

Parameters: ownerid - Owner id of the resource.


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