Содержание
Xml query in java
This generates XML from a SQL query. A typical sequence might look like this:
import java.sql.*; import oracle.xml.sql.query.*; import oracle.jdbc.*; public class sample < public static void main(String args[]) throws Exception < DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@"); OracleXMLQuery qry = new OracleXMLQuery(conn, "select * from emp"); System.out.println(qry.getXMLString()); conn.close(); >>
Field Summary | |
static int | DTD Specifies that a DTD is to be generated |
static java.lang.String | ERROR_TAG Specifies the default tag name for the ERROR document |
static int | MAXROWS_ALL Specifies that all rows should be included in the result |
static int | MAXROWS_DEFAULT Deprecated. since v2.0; Use MAXROWS_ALL instead |
static int | MAXROWS_NONE Deprecated. since v2.0; Use 0 instead |
static int | NONE Specifies that a DTD is not to be generated. |
static java.lang.String | ROW_TAG Specifies the default tag name for ROW elements. |
static java.lang.String | ROWIDATTR_TAG Specifies the default tag name for the ROWIDATTR . |
static java.lang.String | ROWSET_TAG Specifies the default tag name for the document. |
static int | SCHEMA Specifies that an XML schema is not to be generated. |
static int | SKIPROWS_ALL Specifies that all rows be skipped in the result. |
static int | SKIPROWS_DEFAULT Deprecated. since v2.0; Use 0 instead |
static int | SKIPROWS_NONE Deprecated. since v2.0; Use 0 instead |
Constructor Summary | |
OracleXMLQuery(java.sql.Connection conn, java.sql.ResultSet rset) Constructor for the OracleXMLQueryObject. | |
OracleXMLQuery(java.sql.Connection conn, java.lang.String query) Constructor for the OracleXMLQuery object. | |
OracleXMLQuery(oracle.xml.sql.dataset.OracleXMLDataSet dset) Constructor for the OracleXMLQueryObject. |
Method Summary | |
void | bindValue(java.lang.String bindName, java.lang.String bindValue) Sets a bind name/value pair. |
void | close() Closes open resources created by the OracleXML engine. |
long | getNumRowsProcessed() Returns the number of rows processed. |
void | getXML(oracle.xml.sql.docgen.OracleXMLDocGen doc, int metaType) NOTE: THIS IS AN INTERNAL CALL Transforms the object-relational data, specified in the constructor, into an XML document which is returned via the doc argument. |
Document | getXMLDOM() Transforms the object-relational data, specified in the constructor, into an XML document. |
Document | getXMLDOM(boolean withDTD) Deprecated. since 1.2.1; please use getXMLDOM(int) instead |
Document | getXMLDOM(int metaType) Transforms the object-relational data, specified in the constructor, into an XML document. |
Document | getXMLDOM(Node root) Transforms the object-relational data, specified in the constructor, into an XML document. |
Document | getXMLDOM(Node root, int metaType) Transforms the object-relational data, specified in the constructor, into XML. |
java.lang.String | getXMLMetaData(int metaType, boolean withVer) Returns either the DTD or the XMLSchema for the XML document generated by getXML calls. |
void | getXMLSAX(ContentHandler sax) Transforms the object-relational data, specified in the constructor, into an XML document in SAX form. |
Document[] | getXMLSchema() Generates XML Schema(s) corresponding to the query. |
java.lang.String | getXMLString() Transforms the object-relational data, specified in the constructor, into an XML document. |
java.lang.String | getXMLString(boolean withDTD) Deprecated. since 1.2.1; please use getXMLString(int) instead |
java.lang.String | getXMLString(int metaType) Transforms the object-relational data, specified in the constructor, into an XML document. |
java.lang.String | getXMLString(Node root) Transforms the object-relational data, specified in the constructor, into an XML document. |
java.lang.String | getXMLString(Node root, int metaType) Transforms the object-relational data, specified in the constructor, into an XML document. |
void | keepCursorState(boolean alive) Deprecated. since 1.2.1; use keepObjectOpen instead. |
void | keepObjectOpen(boolean alive) Specifies whether to keep the input object open after a getXML()/code> call. |
void | removeXSLTParam(java.lang.String name) Removes the value of a top-level stylesheet parameter. |
void | resetResultSet() Resets the result set to start XML generation from the from the first row of the resultset. |
void | setCollIdAttr(java.lang.String collIdAttr) Deprecated. since 1.2.1; please use setCollIdAttrName instead. |
void | setCollIdAttrName(java.lang.String attrName) Sets the name of the collection element separator tag id attribute. |
void | setDataHeader(java.io.Reader header, java.lang.String docTag) Sets the XML data header. |
void | setDateFormat(java.lang.String mask) Specifies the format of dates used in the XML document. |
void | setEncoding(java.lang.String enc) Sets the processing instruction for encoding, the PI, in the XML document. |
void | setErrorTag(java.lang.String tag) Sets the tag used to enclose the XML error documents. |
void | setException(java.lang.Exception e) Allows the user to pass in an exception, and have the XSU handle it. |
void | setMaxRows(int rows) Sets the maximum number of rows to be converted to XML. |
void | setMetaHeader(java.io.Reader header) Sets the XML meta header. |
void | setRaiseException(boolean flag) Specifies whether to throw the raised exceptions. |
void | setRaiseNoRowsException(boolean flag) Specifies whether to throw an OracleXMLNoRowsException if the generated XML document is empty. |
void | setRowIdAttrName(java.lang.String attrName) Sets the name of the row enclosing tag id attribute. |
void | setRowIdAttrValue(java.lang.String colName) Specifies the scalar column whose value is assigned to the row id attribute. |
void | setRowIdColumn(java.lang.String colName) Deprecated. since 1.2.1 — please use setRowIdAttrValue instead. |
void | setRowsetTag(java.lang.String tag) Sets the tag used to enclose the XML dataset. |
void | setRowTag(java.lang.String tag) Sets the tag to be used to enclose the XML element corresponding to a db. record. |
void | setSkipRows(int rows) Sets the number of rows to skip. |
void | setSQLToXMLNameEscaping(boolean flag) Specifies whether to turn on XML tag escaping for SQL object names, to ensure conversion to valid XML identifiers. |
void | setStyleSheet(java.lang.String uri) Deprecated. since XSU2.0 — please use setStylesheetHeader instead. |
void | setStyleSheet(java.lang.String uri, java.lang.String type) Deprecated. since XSU2.0 — please use setStylesheetHeader instead. |
void | setStylesheetHeader(java.lang.String uri) Sets the stylesheet header processing instructions in the generated XML document. |
void | setStylesheetHeader(java.lang.String uri, java.lang.String type) Sets the stylesheet header processing instructions in the generated XML document. |
void | setXSLT(java.io.Reader stylesheet, java.lang.String ref) Sets the XSL transformation to be applied to generated XML. |
void | setXSLT(java.lang.String stylesheet, java.lang.String ref) Sets the XSL transformation to be applied to generated XML. |
void | setXSLTParam(java.lang.String name, java.lang.String value) Sets the value for top-level stylesheet parameter. |
void | useLowerCaseTagNames() Specifies use of lower case for all tag names. |
void | useNullAttributeIndicator(boolean flag) Specifies whether to use an XML attribute to indicate NULLness, or by omitting the entity from the XML document. |
void | useTypeForCollElemTag(boolean flag) Specifies the use of collection element’s type name as the collection element tag name when called with a TRUE value for the flag parameter. |
void | useUpperCaseTagNames() Specifies use of upper case for all tag names. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MAXROWS_NONE
public static final int MAXROWS_NONE
MAXROWS_ALL
public static final int MAXROWS_ALL