|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--com.ddtek.jxtr.JXTRBase
|
+--com.ddtek.jxtr.JXTRQueryBase
|
+--com.ddtek.jxtr.JXTRResultSetWrapper
JXTRResultSetWrapper implements the methods required to execute a SQL query (instead of a SQL/XML query or jXTransformer query) and generate an XML document. The JXTRResultSetWrapper class wraps XML elements or attributes around the row and column data that is retrieved from the RDBMS.
The JXTRResultSetWrapper class allows you to generate XML documents based on any type of result set generating statement that the RDBMS supports. Statements that generate multiple result sets (typically stored procedures) are also supported; however, stored procedures with output parameters are not supported.
Because an RDBMS statement does not allow you to specify an XML structure, Connect for SQL/XML supports two XML document structures: flat-attribute and element-centric XML documents.
For flat-attribute (attribute-centric) XML documents, all data retrieved from the database is structured inside attributes (one attribute for each column). One element is created for each row retrieved and the column values are defined as its attributes. Attribute names are derived from the database column names.
For element-centric XML documents, all data retrieved from the database is structured inside elements. One element is created for each row retrieved and the column values are defined as its subelements. Element names are derived from the database column names.
Because column names in a database may not always be valid XML element or attribute names (for example, column names can contain spaces, but XML names cannot) an element/attribute name is generated for those columns: 'Column-nnn', where nnn is the index of the column in the result set.
| Field Summary | |
static int |
ATTRIBUTE_CENTRIC
Constant value used to generate flat-attribute XML documents. |
static int |
ELEMENT_CENTRIC
Constant value used to generate element-centric XML documents. |
| Fields inherited from class com.ddtek.jxtr.JXTRQueryBase |
JDBC_PREPARED_STAT, JDBC_STAT, JDBC_STATTYPE_NOTSET |
| Fields inherited from class com.ddtek.jxtr.JXTRBase |
BINARY_AS_BASE64, BINARY_AS_HEX, TIMESTAMP_AS_ISO8601, TIMESTAMP_AS_ODBC |
| Constructor Summary | |
JXTRResultSetWrapper(java.sql.Connection con,
java.lang.String stat,
int mode)
Constructs a JXTRResultSetWrapper object. |
|
| Method Summary | |
void |
close()
Closes database prepared statement(s). |
void |
dump(java.io.Writer dumpTo)
Dumps the JXTRQuery internal structure. |
org.w3c.dom.Document |
executeDOM()
Executes the jXTransformer query and returns the XML result as a DOM level 2 document object. |
void |
executeDOM(org.w3c.dom.Node domNode)
Executes the jXTransformer query and creates the XML result under the specified DOM level 2 node. |
org.jdom.Document |
executeJDOM()
Executes the jXTransformer query and returns a JDOM document. |
void |
executeJDOM(org.jdom.Element domElement)
Executes the jXTransformer query and creates the XML result under the specified JDOM element node. |
void |
executeSAX(org.xml.sax.XMLReader xmlReader)
Executes the jXTransformer query and invokes SAX2 callbacks registered with the specified XMLReader. |
void |
executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader)
Executes the jXTransformer query and writes the XML as a character stream to the specified writer, which should use UTF-8 encoding. |
void |
executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader,
int indentLevel)
Executes the jXTransformer query and writes the XML result as a character stream to the specified writer, which should use UTF-8 encoding. |
void |
executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader,
java.lang.String encoding)
Executes the jXTransformer query and writes the XML result as a character stream to the specified writer, which should use the specified encoding. |
void |
executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader,
java.lang.String encoding,
int indentLevel)
Executes the jXTransformer query and writes the XML as a character stream to the specified writer, which should use the specified encoding. |
void |
generateDTD(java.io.Writer dtdWriter)
Generates a DTD describing the structure of the jXTransformer query result and writes the DTD to the specified Writer. |
void |
generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap)
Generates multiple XML Schemas describing the structure of the jXTransformer query result. |
void |
generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap,
int indentLevel)
Generates multiple XML Schemas describing the structure of the jXTransformer query result. |
void |
generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap,
java.lang.String encoding)
Generates multiple XML Schemas describing the structure of the jXTransformer query result. |
void |
generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap,
java.lang.String encoding,
int indentLevel)
Generates multiple XML Schemas describing the structure of the jXTransformer query result. |
void |
generateXMLSchema(java.io.Writer schemaWriter)
Generates an XML Schema describing the structure of the jXTransformer query result and writes the XML Schema to the specified Writer. |
void |
generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace)
Generates an XML Schema describing the structure of the jXTransformer query result and writes the XML Schema to the specified Writer, which should use UTF-8 encoding. |
void |
generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace,
int indentLevel)
Generates an XML Schema describing the structure of the jXTransformer query result and writes the XML Schema to the specified Writer, which should use UTF-8 encoding. |
void |
generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace,
java.lang.String encoding)
Generates an XML Schema describing the structure of the jXTransformer query result and writes the result to the specified Writer, which should use the specified encoding. |
void |
generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace,
java.lang.String encoding,
int indentLevel)
Generates an XML Schema describing the structure of the jXTransformer query result and writes the XML Schema to the specified Writer, which should use the specified encoding. |
java.lang.String |
getRowElementTag()
Gets the XML name for the row tags. |
void |
setRowElementTag(java.lang.String rowElementTag)
Sets the XML name for the row tags. |
| Methods inherited from class com.ddtek.jxtr.JXTRBase |
clearWarnings, getPreparedStatementCloseBehaviour, getWarnings, setPreparedStatementCloseBehaviour, unlock |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int ATTRIBUTE_CENTRIC
public static final int ELEMENT_CENTRIC
| Constructor Detail |
public JXTRResultSetWrapper(java.sql.Connection con,
java.lang.String stat,
int mode)
throws JXTRException
con - Reference to an open JDBC connection. The connection must
be kept open until the last 'execute' has been invoked.stat - RDBMS statement for which XML will be generated.mode - XML structure (either ATTRIBUTE_CENTRIC or
ELEMENT_CENTRIC).
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException| Method Detail |
public void close()
throws JXTRException
JXTRBase
close in class JXTRBaseJXTRException - if an error occured during closing of
resources or database statement(s).
public void setRowElementTag(java.lang.String rowElementTag)
throws JXTRException
rowElementTag - The element name for the row tag.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRExceptionpublic java.lang.String getRowElementTag()
public org.w3c.dom.Document executeDOM()
throws JXTRException
JXTRQueryBaseTo create the DOM level 2 object, Connect for SQL/XML uses JAXP 1.1. Any DOM level 2 implementation that supports JAXP 1.1 can be used.
executeDOM in class JXTRQueryBaseJXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void executeDOM(org.w3c.dom.Node domNode)
throws JXTRException
JXTRQueryBase
executeDOM in class JXTRQueryBasedomNode - DOM level 2 node under which the XML result will
be created.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader)
throws JXTRException
JXTRQueryBase
executeWriter in class JXTRQueryBasexmlWriter - Writer to which the XML result will be streamed.outputDocHeader - When set to false, no XML
document header or root element will be created. When set to
true, a complete XML document will be created with
a document header and root element. If a root element is not
specified, a default root element of jxtr-result will be used
(see JXTRQueryBase.setRootTag(String)).
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader,
int indentLevel)
throws JXTRException
JXTRQueryBase
executeWriter in class JXTRQueryBasexmlWriter - Writer to which the XML document will be streamed.outputDocHeader - When set to false, no XML
document header or root element will be created. When set to
true, a complete XML document will be created with
a document header and root element. If a root element is not
specified, a default root element of jxtr-result will be used
(see JXTRQueryBase.setRootTag(String)).indentLevel - Number of spaces each element level will be indented.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader,
java.lang.String encoding)
throws JXTRException
JXTRQueryBase
executeWriter in class JXTRQueryBasexmlWriter - Writer to which the XML result will be streamed.outputDocHeader - When set to false, no XML
document header or root element will be created. When set to
true, a complete XML document will be created with
a document header and root element. If a root element is not
specified, a default root element of jxtr-result will be used
(see JXTRQueryBase.setRootTag(String)).encoding - Encoding the specified writer will use.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void executeWriter(java.io.Writer xmlWriter,
boolean outputDocHeader,
java.lang.String encoding,
int indentLevel)
throws JXTRException
JXTRQueryBase
executeWriter in class JXTRQueryBasexmlWriter - Writer to which the XML document will be streamed.outputDocHeader - When set to false, no XML
document header or root element is created. When set to
true, a complete XML document is created with
a document header and root element. If a root element is not
specified, a default root element of jxtr-result will be used
(see JXTRQueryBase.setRootTag(String)).encoding - Encoding the specified writer will use.indentLevel - Number of spaces each element level will be indented.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public org.jdom.Document executeJDOM()
throws JXTRException
JXTRQueryBase
executeJDOM in class JXTRQueryBaseJXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
org.jdom.Document
public void executeJDOM(org.jdom.Element domElement)
throws JXTRException
JXTRQueryBase
executeJDOM in class JXTRQueryBasedomElement - JDOM element node under which the resulting XML
will be created.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void executeSAX(org.xml.sax.XMLReader xmlReader)
throws JXTRException
JXTRQueryBaseThe xmlReader must be an object of type JXTRSaxReader
or the xmlReader features must be set as supported by
JXTRSaxReader.
executeSAX in class JXTRQueryBasexmlReader - SAX2 XML Reader whose registered handlers
will receive the SAX2 events.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void dump(java.io.Writer dumpTo)
throws JXTRException
JXTRQueryBase
dump in class JXTRQueryBasedumpTo - Writer to which the information will be dumped.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void generateDTD(java.io.Writer dtdWriter)
throws JXTRException
JXTRQueryBase
generateDTD in class JXTRQueryBasedtdWriter - Writer to which the DTD will be written.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException
public void generateXMLSchema(java.io.Writer schemaWriter)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBaseschemaWriter - Writer to which the XML Schema will be written.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBaseschemaWriter - Writer to which the XML Schema will be written.targetNamespace - Namespace for which the XML Schema will be
generated or null to generate an XML Schema for those
elements/attributes that do not have a namespace.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace,
java.lang.String encoding)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBaseschemaWriter - Writer to which the XML Schema will be written.targetNamespace - Namespace for which the XML Schema will be
generated or null to generate an XML Schema for those
elements/attributes that do not have a namespace.encoding - Encoding the specified writer will use.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace,
int indentLevel)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBaseschemaWriter - Writer to which the XML Schema will be written.targetNamespace - Namespace for which the XML Schema will be
generated or null to generate an XML Schema for those
elements/attributes that do not have a namespace.indentLevel - Number of spaces to indent each element level.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.io.Writer schemaWriter,
java.lang.String targetNamespace,
java.lang.String encoding,
int indentLevel)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBaseschemaWriter - Writer to which the XML Schema is written.targetNamespace - Namespace for which the XML Schema will be
generated or null to generate an XML Schema for those
elements/attributes that do not have a namespace.encoding - Encoding the specified writer will use.indentLevel - Number of spaces to indent each element level.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBasetargetNamespaceSchemaFileMap - Map containing the
namespaces (keys) and their associated output XML Schema
filenames (values). A null key is used to generate XML
Schemas for elements/attributes that do not have a namespace.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap,
java.lang.String encoding)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBasetargetNamespaceSchemaFileMap - Map containing the
namespaces (keys) and their associated output XML Schema
filenames (values). A null key is used to generate XML
Schemas for elements/attributes that do not have a namespace.encoding - Encoding the specified writer will use.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap,
int indentLevel)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBasetargetNamespaceSchemaFileMap - Map containing the
namespaces (keys) and their associated output XML Schema
filenames (values). A null key is used to generate XML
Schemas for elements/attributes that do not have a namespace.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
public void generateXMLSchema(java.util.Map targetNamespaceSchemaFileMap,
java.lang.String encoding,
int indentLevel)
throws JXTRException
JXTRQueryBase
generateXMLSchema in class JXTRQueryBasetargetNamespaceSchemaFileMap - Map containing the
namespaces (keys) and their associated output XML Schema
filenames (values). A null key is used to generate XML
Schemas for elements/attributes that do not have a namespace.encoding - Encoding the specified writer will use.
JXTRException - Refer to the JXTRException class
for more information about possible error conditions.JXTRException,
XML Schema Part 0: Primer,
XML Schema Part 1: Structures,
XML Schema Part 2: Datatypes
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||