|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.JDBC4MysqlSQLXML
public class JDBC4MysqlSQLXML
Nested Class Summary | |
---|---|
(package private) class |
JDBC4MysqlSQLXML.SimpleSaxToReader
|
Constructor Summary | |
---|---|
protected |
JDBC4MysqlSQLXML(ExceptionInterceptor exceptionInterceptor)
|
protected |
JDBC4MysqlSQLXML(ResultSetInternalMethods owner,
int index,
ExceptionInterceptor exceptionInterceptor)
|
Method Summary | |
---|---|
protected java.lang.String |
domSourceToString()
|
void |
free()
|
java.io.InputStream |
getBinaryStream()
|
java.io.Reader |
getCharacterStream()
Retrieves the XML value designated by this SQLXML instance as a java.io.Reader object. |
javax.xml.transform.Source |
getSource(java.lang.Class clazz)
Returns a Source for reading the XML value designated by this SQLXML instance. |
java.lang.String |
getString()
|
boolean |
isEmpty()
|
protected java.lang.String |
readerToString(java.io.Reader reader)
|
protected java.io.Reader |
serializeAsCharacterStream()
|
protected java.lang.String |
serializeAsString()
|
java.io.OutputStream |
setBinaryStream()
Retrieves a stream that can be used to write the XML value that this SQLXML instance represents. |
java.io.Writer |
setCharacterStream()
Retrieves a stream to be used to write the XML value that this SQLXML instance represents. |
javax.xml.transform.Result |
setResult(java.lang.Class clazz)
Returns a Result for setting the XML value designated by this SQLXML instance. |
void |
setString(java.lang.String str)
Sets the XML value designated by this SQLXML instance to the given String representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected JDBC4MysqlSQLXML(ResultSetInternalMethods owner, int index, ExceptionInterceptor exceptionInterceptor)
protected JDBC4MysqlSQLXML(ExceptionInterceptor exceptionInterceptor)
Method Detail |
---|
public void free() throws java.sql.SQLException
free
in interface java.sql.SQLXML
java.sql.SQLException
public java.lang.String getString() throws java.sql.SQLException
getString
in interface java.sql.SQLXML
java.sql.SQLException
public void setString(java.lang.String str) throws java.sql.SQLException
The SQL XML object becomes not writeable when this method is called and may also become not readable depending on implementation.
setString
in interface java.sql.SQLXML
value
- the XML value
java.sql.SQLException
- if there is an error processing the XML value. The getCause()
method of the exception may provide a more detailed
exception, for example, if the stream does not contain valid
characters. An exception is thrown if the state is not
writable.
java.sql.SQLFeatureNotSupportedException
- if the JDBC driver does not support this methodpublic boolean isEmpty() throws java.sql.SQLException
java.sql.SQLException
public java.io.InputStream getBinaryStream() throws java.sql.SQLException
getBinaryStream
in interface java.sql.SQLXML
java.sql.SQLException
public java.io.Reader getCharacterStream() throws java.sql.SQLException
The SQL XML object becomes not readable when this method is called and may also become not writable depending on implementation.
getCharacterStream
in interface java.sql.SQLXML
java.sql.SQLException
- if there is an error processing the XML value. The getCause()
method of the exception may provide a more detailed
exception, for example, if the stream does not contain valid
characters. An exception is thrown if the state is not
readable.
java.sql.SQLFeatureNotSupportedException
- if the JDBC driver does not support this methodpublic javax.xml.transform.Source getSource(java.lang.Class clazz) throws java.sql.SQLException
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());
getSource
in interface java.sql.SQLXML
sourceClass
- The class of the source, or null. If the class is null, a
vendor specifc Source implementation will be returned. The
following classes are supported at a minimum:
(MySQL returns a SAXSource if sourceClass == null)
javax.xml.transform.dom.DOMSource - returns a DOMSource javax.xml.transform.sax.SAXSource - returns a SAXSource javax.xml.transform.stax.StAXSource - returns a StAXSource javax.xml.transform.stream.StreamSource - returns a StreamSource
java.sql.SQLException
- if there is an error processing the XML value or if this
feature is not supported. The getCause() method of the
exception may provide a more detailed exception, for example,
if an XML parser exception occurs. An exception is thrown if
the state is not readable.
java.sql.SQLFeatureNotSupportedException
- if the JDBC driver does not support this methodpublic java.io.OutputStream setBinaryStream() throws java.sql.SQLException
The SQL XML object becomes not writeable when this method is called and may also become not readable depending on implementation.
setBinaryStream
in interface java.sql.SQLXML
java.sql.SQLException
- if there is an error processing the XML value. An exception
is thrown if the state is not writable.
java.sql.SQLFeatureNotSupportedException
- if the JDBC driver does not support this methodpublic java.io.Writer setCharacterStream() throws java.sql.SQLException
The SQL XML object becomes not writeable when this method is called and may also become not readable depending on implementation.
setCharacterStream
in interface java.sql.SQLXML
java.sql.SQLException
- if there is an error processing the XML value. The getCause()
method of the exception may provide a more detailed
exception, for example, if the stream does not contain valid
characters. An exception is thrown if the state is not
writable.
java.sql.SQLFeatureNotSupportedException
- if the JDBC driver does not support this methodpublic javax.xml.transform.Result setResult(java.lang.Class clazz) throws java.sql.SQLException
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();
setResult
in interface java.sql.SQLXML
resultClass
- The class of the result, or null. If resultClass is null, a
vendor specific Result implementation will be returned. The
following classes are supported at a minimum:
javax.xml.transform.dom.DOMResult - returns a DOMResult javax.xml.transform.sax.SAXResult - returns a SAXResult javax.xml.transform.stax.StAXResult - returns a StAXResult javax.xml.transform.stream.StreamResult - returns a StreamResult
java.sql.SQLException
- if there is an error processing the XML value or if this
feature is not supported. The getCause() method of the
exception may provide a more detailed exception, for example,
if an XML parser exception occurs. An exception is thrown if
the state is not writable.
java.sql.SQLFeatureNotSupportedException
- if the JDBC driver does not support this methodprotected java.lang.String readerToString(java.io.Reader reader) throws java.sql.SQLException
java.sql.SQLException
protected java.io.Reader serializeAsCharacterStream() throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String domSourceToString() throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String serializeAsString() throws java.sql.SQLException
java.sql.SQLException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |