| |
|
| java.lang.Object com.mysql.jdbc.JDBC4MysqlSQLXML
JDBC4MysqlSQLXML | public class JDBC4MysqlSQLXML implements SQLXML(Code) | | |
Method Summary | |
protected String | domSourceToString() | public synchronized void | free() | public synchronized InputStream | getBinaryStream() | public synchronized Reader | getCharacterStream() Retrieves the XML value designated by this SQLXML instance as a
java.io.Reader object. | public synchronized Source | getSource(Class clazz) Returns a Source for reading the XML value designated by this SQLXML
instance. | public synchronized String | getString() | public synchronized boolean | isEmpty() | protected String | readerToString(Reader reader) | protected synchronized Reader | serializeAsCharacterStream() | protected synchronized String | serializeAsString() | public synchronized OutputStream | setBinaryStream() Retrieves a stream that can be used to write the XML value that this
SQLXML instance represents. | public synchronized Writer | setCharacterStream() Retrieves a stream to be used to write the XML value that this SQLXML
instance represents. | public synchronized Result | setResult(Class clazz) Returns a Result for setting the XML value designated by this SQLXML
instance.
The systemID of the Result is implementation dependent.
The SQL XML object becomes not writeable when this method is called and
may also become not readable depending on implementation.
Note that SAX is a callback architecture and the returned SAXResult has a
content handler assigned that will receive the SAX events based on the
contents of the XML. | public synchronized void | setString(String str) Sets the XML value designated by this SQLXML instance to the given String
representation. |
JDBC4MysqlSQLXML | protected JDBC4MysqlSQLXML()(Code) | | |
getCharacterStream | public synchronized Reader getCharacterStream() throws SQLException(Code) | | Retrieves the XML value designated by this SQLXML instance as a
java.io.Reader object. The format of this stream is defined by
org.xml.sax.InputSource, where the characters in the stream represent the
unicode code points for XML according to section 2 and appendix B of the
XML 1.0 specification. Although an encoding declaration other than
unicode may be present, the encoding of the stream is unicode. The
behavior of this method is the same as ResultSet.getCharacterStream()
when the designated column of the ResultSet has a type java.sql.Types of
SQLXML.
The SQL XML object becomes not readable when this method is called and
may also become not writable depending on implementation.
a stream containing the XML data. throws: SQLException - if there is an error processing the XML value. The getCause()method of the exception may provide a more detailedexception, for example, if the stream does not contain validcharacters. An exception is thrown if the state is notreadable. exception: SQLFeatureNotSupportedException - if the JDBC driver does not support this method since: 1.6 |
getSource | public synchronized Source getSource(Class clazz) throws SQLException(Code) | | Returns a Source for reading the XML value designated by this SQLXML
instance. Sources are used as inputs to XML parsers and XSLT
transformers.
Sources for XML parsers will have namespace processing on by default. The
systemID of the Source is implementation dependent.
The SQL XML object becomes not readable when this method is called and
may also become not writable depending on implementation.
Note that SAX is a callback architecture, so a returned SAXSource should
then be set with a content handler that will receive the SAX events from
parsing. The content handler will receive callbacks based on the contents
of the XML.
SAXSource saxSource = sqlxml.getSource(SAXSource.class);
XMLReader xmlReader = saxSource.getXMLReader();
xmlReader.setContentHandler(myHandler);
xmlReader.parse(saxSource.getInputSource());
Parameters: sourceClass - The class of the source, or null. If the class is null, avendor specifc Source implementation will be returned. Thefollowing classes are supported at a minimum:(MySQL returns a SAXSource if sourceClass == null)javax.xml.transform.dom.DOMSource - returns a DOMSourcejavax.xml.transform.sax.SAXSource - returns a SAXSourcejavax.xml.transform.stax.StAXSource - returns a StAXSourcejavax.xml.transform.stream.StreamSource - returns a StreamSource a Source for reading the XML value. throws: SQLException - if there is an error processing the XML value or if thisfeature is not supported. The getCause() method of theexception may provide a more detailed exception, for example,if an XML parser exception occurs. An exception is thrown ifthe state is not readable. exception: SQLFeatureNotSupportedException - if the JDBC driver does not support this method since: 1.6 |
setBinaryStream | public synchronized OutputStream setBinaryStream() throws SQLException(Code) | | Retrieves a stream that can be used to write the XML value that this
SQLXML instance represents. The stream begins at position 0. The bytes of
the stream are interpreted according to appendix F of the XML 1.0
specification The behavior of this method is the same as
ResultSet.updateBinaryStream() when the designated column of the
ResultSet has a type java.sql.Types of SQLXML.
The SQL XML object becomes not writeable when this method is called and
may also become not readable depending on implementation.
a stream to which data can be written. throws: SQLException - if there is an error processing the XML value. An exceptionis thrown if the state is not writable. exception: SQLFeatureNotSupportedException - if the JDBC driver does not support this method since: 1.6 |
setCharacterStream | public synchronized Writer setCharacterStream() throws SQLException(Code) | | Retrieves a stream to be used to write the XML value that this SQLXML
instance represents. The format of this stream is defined by
org.xml.sax.InputSource, where the characters in the stream represent the
unicode code points for XML according to section 2 and appendix B of the
XML 1.0 specification. Although an encoding declaration other than
unicode may be present, the encoding of the stream is unicode. The
behavior of this method is the same as ResultSet.updateCharacterStream()
when the designated column of the ResultSet has a type java.sql.Types of
SQLXML.
The SQL XML object becomes not writeable when this method is called and
may also become not readable depending on implementation.
a stream to which data can be written. throws: SQLException - if there is an error processing the XML value. The getCause()method of the exception may provide a more detailedexception, for example, if the stream does not contain validcharacters. An exception is thrown if the state is notwritable. exception: SQLFeatureNotSupportedException - if the JDBC driver does not support this method since: 1.6 |
setResult | public synchronized Result setResult(Class clazz) throws SQLException(Code) | | Returns a Result for setting the XML value designated by this SQLXML
instance.
The systemID of the Result is implementation dependent.
The SQL XML object becomes not writeable when this method is called and
may also become not readable depending on implementation.
Note that SAX is a callback architecture and the returned SAXResult has a
content handler assigned that will receive the SAX events based on the
contents of the XML. Call the content handler with the contents of the
XML document to assign the values.
SAXResult saxResult = sqlxml.setResult(SAXResult.class);
ContentHandler contentHandler = saxResult.getXMLReader().getContentHandler();
contentHandler.startDocument();
// set the XML elements and attributes into the result
contentHandler.endDocument();
Parameters: resultClass - The class of the result, or null. If resultClass is null, avendor specific Result implementation will be returned. Thefollowing classes are supported at a minimum:javax.xml.transform.dom.DOMResult - returns a DOMResultjavax.xml.transform.sax.SAXResult - returns a SAXResultjavax.xml.transform.stax.StAXResult - returns a StAXResultjavax.xml.transform.stream.StreamResult - returns a StreamResult Returns a Result for setting the XML value. throws: SQLException - if there is an error processing the XML value or if thisfeature is not supported. The getCause() method of theexception may provide a more detailed exception, for example,if an XML parser exception occurs. An exception is thrown ifthe state is not writable. exception: SQLFeatureNotSupportedException - if the JDBC driver does not support this method since: 1.6 |
setString | public synchronized void setString(String str) throws SQLException(Code) | | Sets the XML value designated by this SQLXML instance to the given String
representation. The format of this String is defined by
org.xml.sax.InputSource, where the characters in the stream represent the
unicode code points for XML according to section 2 and appendix B of the
XML 1.0 specification. Although an encoding declaration other than
unicode may be present, the encoding of the String is unicode. The
behavior of this method is the same as ResultSet.updateString() when the
designated column of the ResultSet has a type java.sql.Types of SQLXML.
The SQL XML object becomes not writeable when this method is called and
may also become not readable depending on implementation.
Parameters: value - the XML value throws: SQLException - if there is an error processing the XML value. The getCause()method of the exception may provide a more detailedexception, for example, if the stream does not contain validcharacters. An exception is thrown if the state is notwritable. exception: SQLFeatureNotSupportedException - if the JDBC driver does not support this method since: 1.6 |
|
|
|