public class JAXBResult extends SAXResult
Result
JAXB对象。
本实用新型是JAXB类与其他java和XML技术的结合使用。
下面的示例演示如何使用JAXB数据从XSLT转换文件。
JAXBResult result = new JAXBResult( JAXBContext.newInstance("org.acme.foo") ); // set up XSLT transformation TransformerFactory tf = TransformerFactory.newInstance(); Transformer t = tf.newTransformer(new StreamSource("test.xsl")); // run transformation t.transform(new StreamSource("document.xml"),result); // obtain the unmarshalled content tree Object o = result.getResult();
事实上,jaxbresult来自SAXResult是实现的细节。因此,在一般的应用是强烈阻止访问定义在SAXResult方法。
特别是它不会尝试调用sethandler,setlexicalhandler,和setsystemid方法。
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
Constructor and Description |
---|
JAXBResult(JAXBContext context)
创建一个新的实例,使用指定的送解编。
|
JAXBResult(Unmarshaller _unmarshaller)
创建一个新的实例,使用指定的配置来分解对象。
|
Modifier and Type | Method and Description |
---|---|
Object |
getResult()
被改造的对象创建它们分散。
|
getHandler, getLexicalHandler, getSystemId, setHandler, setLexicalHandler, setSystemId
public JAXBResult(JAXBContext context) throws JAXBException
context
-送将用于创建必要的配置。此参数不能为空。
JAXBException
-如果遇到错误而创建的jaxbresult或者上下文参数为空。
public JAXBResult(Unmarshaller _unmarshaller) throws JAXBException
这jaxbresult对象将使用指定的配置实例。这是对方的责任,不使用相同的Unmarshaller为其他目的而它正在用这个对象。
这种方法的主要目的是让客户端配置Unmarshaller。除非你知道你正在做什么,这是更容易和更安全的通过送。
_unmarshaller
-配置。此参数不能为空。
JAXBException
-如果遇到错误而创建的jaxbresult或配置参数为空。
public Object getResult() throws JAXBException
IllegalStateException
-如果这种方法之前一个对象是它们分散为。
JAXBException
-如果有任何反错误。注意,执行是允许把saxexception在分析时发现错误。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.