All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.xmlmiddleware.xmldbms.DBMSToDOM

java.lang.Object
   |
   +----org.xmlmiddleware.xmldbms.DBMSToDOM

public class DBMSToDOM
extends Object
Transfers data from the database to a DOM tree.

DBMSToDOM transfers data from the database to a DOM tree according to a particular XMLDBMSMap and FilterSet. The map provides the general structural mapping from the database to XML; the filters specify exactly which data are to be transferred. In addition, DBMSToDOM can transfer data from application-constructed result sets to XML.

For example, the following code transfers data according to the map document orders.map and the filter document ordersbynumber.ftr, which uses sales order number as a parameter:

    // Create the XMLDBMSMap object with a user-defined function.
    map = createMap("orders.map");
    // Create the FilterSet object with a user-defined function.
    filterSet = createFilterSet(map, "ordersbynumber.ftr");
    // Create a new DBMSToDOM object that uses the Xerces parser.
    dbmsToDOM = new DBMSToDOM(new ParserUtilsXerces());
    // Create a data source and data handler for our database, then
    // bundle these into a TransferInfo object.
    ds = new JDBC1DataSource("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:xmldbms");
    handler = new GenericHandler(ds, null, null);
    ti = new TransferInfo(map, null, handler);
    // Build the parameters hashtable.
    params = new Hashtable();
    params.put("$Number", "123");
    // Call retrieveDocument to transfer the data.
    doc = dbmsToDOM.retrieveDocument(ti, filterSet, params, null);
 

Version:
2.0
Author:
Ronald Bourret

Constructor Index

 o DBMSToDOM(ParserUtils)
Construct a new DBMSToDOM object.

Method Index

 o retrieveDocument(TransferInfo, FilterSet, Hashtable, Node)
Retrieve a document based on the specified filters.
 o retrieveDocument(TransferInfo, Hashtable, FilterSet, Hashtable, Node)
Retrieve a document based on the specified result sets.
 o retrieveDocument(TransferInfo, ResultSet, FilterSet, Hashtable, Node)
Retrieve a document based on a result set.
 o setDTDInfo(String, String)
Set the system and public IDs to use in the DOCTYPE statement.

Constructors

 o DBMSToDOM
 public DBMSToDOM(ParserUtils utils) throws SAXException, XMLMiddlewareException
Construct a new DBMSToDOM object.

Parameters:
utils - A ParserUtils object.
Throws: SAXException
Thrown if the XMLReader does not support namespaces.
Throws: XMLMiddlewareException
Thrown if an error occurs instantiating the XMLReader.

Methods

 o setDTDInfo
 public void setDTDInfo(String systemID,
                        String publicID)
Set the system and public IDs to use in the DOCTYPE statement.

Parameters:
systemID - The system ID. Non-null if the public ID is non-null. Otherwise, may be null.
publicID - The public ID. May be null.
 o retrieveDocument
 public Document retrieveDocument(TransferInfo transferInfo,
                                  FilterSet filterSet,
                                  Hashtable params,
                                  Node rootNode) throws SQLException, XMLMiddlewareException
Retrieve a document based on the specified filters.

The filter set must contain at least one root filter.

Parameters:
transferInfo - Map and connection information.
filterSet - The filter set specifying the data to retrieve.
params - A Hashtable containing the names (keys) and values (elements) of any parameters used in the filters. Null if there are no parameters.
rootNode - The Node to which the retrieved document is to be added. If this is null, retrieveDocument will create a new Document.
Returns:
The document. If rootNode is not null, this is the owner Document. Otherwise, it is a new Document.
Throws: SQLException
Thrown if a database error occurs retrieving data
Throws: XMLMiddlewareException
Thrown if an XML-DBMS error occurs retrieving data.
 o retrieveDocument
 public Document retrieveDocument(TransferInfo transferInfo,
                                  ResultSet rs,
                                  FilterSet filterSet,
                                  Hashtable params,
                                  Node rootNode) throws SQLException, XMLMiddlewareException
Retrieve a document based on a result set.

The filter set must contain exactly one result set filter.

Parameters:
transferInfo - Map and connection information.
rs - The result set. The filter for the result set must use the name "Default".
filterSet - The filter set specifying the data to retrieve.
params - A Hashtable containing the names (keys) and values (elements) of any parameters used in the filters. Null if there are no parameters.
rootNode - The Node to which the retrieved document is to be added. If this is null, retrieveDocument will create a new Document.
Returns:
The document. If rootNode is not null, this is the owner Document. Otherwise, it is a new Document.
Throws: SQLException
Thrown if a database error occurs retrieving data
Throws: XMLMiddlewareException
Thrown if an XML-DBMS error occurs retrieving data.
 o retrieveDocument
 public Document retrieveDocument(TransferInfo transferInfo,
                                  Hashtable resultSets,
                                  FilterSet filterSet,
                                  Hashtable params,
                                  Node rootNode) throws SQLException, XMLMiddlewareException
Retrieve a document based on the specified result sets.

The filter set must contain at least one root filter.

Parameters:
transferInfo - Map and connection information.
resultSets - An hashtable containing result sets keyed by result set name. There must be one result set for each result set filter in the filter set.
filterSet - The filter set specifying the data to retrieve.
params - A Hashtable containing the names (keys) and values (elements) of any parameters used in the filters. Null if there are no parameters.
rootNode - The Node to which the retrieved document is to be added. If this is null, retrieveDocument will create a new Document.
Returns:
The document. If rootNode is not null, this is the owner Document. Otherwise, it is a new Document.
Throws: SQLException
Thrown if a database error occurs retrieving data
Throws: XMLMiddlewareException
Thrown if an XML-DBMS error occurs retrieving data.

All Packages  Class Hierarchy  This Package  Previous  Next  Index