本文整理匯總了Java中javax.xml.transform.sax.SAXResult.getHandler方法的典型用法代碼示例。如果您正苦於以下問題:Java SAXResult.getHandler方法的具體用法?Java SAXResult.getHandler怎麽用?Java SAXResult.getHandler使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.xml.transform.sax.SAXResult
的用法示例。
在下文中一共展示了SAXResult.getHandler方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setResult
import javax.xml.transform.sax.SAXResult; //導入方法依賴的package包/類
@Override
public void setResult(Result result) throws IllegalArgumentException
{
SAXResult saxResult = toSAXResult(result);
ContentHandler handler = saxResult.getHandler();
this.nextContentHandler = handler;
if (handler instanceof LexicalHandler)
{
this.nextLexicalHandler = (LexicalHandler) handler;
}
if (handler instanceof DTDHandler)
{
this.nextDtdHandler = (DTDHandler) handler;
}
}
示例2: setResult
import javax.xml.transform.sax.SAXResult; //導入方法依賴的package包/類
/** {@inheritDoc} */
public void setResult(Result result) throws IFException {
if (result instanceof SAXResult) {
SAXResult saxResult = (SAXResult)result;
this.handler = new GenerationHelperContentHandler(
saxResult.getHandler(), getMainNamespace());
} else {
this.handler = new GenerationHelperContentHandler(
createContentHandler(result), getMainNamespace());
}
}
示例3: SaxSerializer
import javax.xml.transform.sax.SAXResult; //導入方法依賴的package包/類
public SaxSerializer(SAXResult result) {
this(result.getHandler(),result.getLexicalHandler());
}
示例4: showSetters
import javax.xml.transform.sax.SAXResult; //導入方法依賴的package包/類
private static void showSetters(Connection con) {
try {
// Create and execute an SQL statement, retrieving an updatable result set.
String SQL = "SELECT * FROM TestTable1;";
Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery(SQL);
// Create an empty SQLXML object.
SQLXML sqlxml = con.createSQLXML();
// Set the result value from SAX events.
SAXResult sxResult = sqlxml.setResult(SAXResult.class);
ContentHandler myHandler = sxResult.getHandler();
// Set the XML elements and attributes into the result.
myHandler.startDocument();
myHandler.startElement(null, "contact", "contact", null);
myHandler.startElement(null, "name", "name", null);
myHandler.endElement(null, "name", "name");
myHandler.startElement(null, "phone", "phone", null);
myHandler.endElement(null, "phone", "phone");
myHandler.endElement(null, "contact", "contact");
myHandler.endDocument();
// Update the data in the result set.
rs.moveToInsertRow();
rs.updateString("Col2", "C");
rs.updateSQLXML("Col3", sqlxml);
rs.insertRow();
// Display the data.
System.out.println("showSetters method: Display data in TestTable1 => ");
while (rs.next()) {
System.out.println(rs.getString("Col1") + " : " + rs.getString("Col2"));
SQLXML xml = rs.getSQLXML("Col3");
System.out.println("XML column : " + xml.getString());
}
} catch (Exception e) {
e.printStackTrace();
}
}
示例5: marshalSaxResult
import javax.xml.transform.sax.SAXResult; //導入方法依賴的package包/類
/**
* Template method for handling {@code SAXResult}s.
* <p>This implementation delegates to {@code marshalSaxHandlers}.
* @param graph the root of the object graph to marshal
* @param saxResult the {@code SAXResult}
* @throws XmlMappingException if the given object cannot be marshalled to the result
* @see #marshalSaxHandlers(Object, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler)
*/
protected void marshalSaxResult(Object graph, SAXResult saxResult) throws XmlMappingException {
ContentHandler contentHandler = saxResult.getHandler();
Assert.notNull(contentHandler, "ContentHandler not set on SAXResult");
LexicalHandler lexicalHandler = saxResult.getLexicalHandler();
marshalSaxHandlers(graph, contentHandler, lexicalHandler);
}