本文整理汇总了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);
}