当前位置: 首页>>代码示例>>Java>>正文


Java JAXBResult.getResult方法代码示例

本文整理汇总了Java中javax.xml.bind.util.JAXBResult.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java JAXBResult.getResult方法的具体用法?Java JAXBResult.getResult怎么用?Java JAXBResult.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.xml.bind.util.JAXBResult的用法示例。


在下文中一共展示了JAXBResult.getResult方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readPayloadAsJAXB

import javax.xml.bind.util.JAXBResult; //导入方法依赖的package包/类
@Override
public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
    JAXBResult out = new JAXBResult(unmarshaller);
    // since the bridge only produces fragments, we need to fire start/end document.
    try {
        out.getHandler().startDocument();
        if (rawContext != null) {
            Marshaller m = rawContext.createMarshaller();
            m.setProperty("jaxb.fragment", Boolean.TRUE);
            m.marshal(jaxbObject,out);
        } else
            bridge.marshal(jaxbObject,out);
        out.getHandler().endDocument();
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
    return (T)out.getResult();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:JAXBMessage.java

示例2: getJAXBObject

import javax.xml.bind.util.JAXBResult; //导入方法依赖的package包/类
private T getJAXBObject(MCRContent source, XMLReader reader, TransformerHandler transformerHandler)
    throws JAXBException, IOException, SAXException {
    checkContext();
    JAXBResult result = new JAXBResult(context);
    transformerHandler.setResult(result);
    // Parse the source XML, and send the parse events to the
    // TransformerHandler.
    reader.parse(source.getInputSource());
    Object parsedResult = result.getResult();
    if (parsedResult instanceof JAXBElement<?>) {
        @SuppressWarnings("unchecked")
        JAXBElement<T> jaxbElement = (JAXBElement<T>) parsedResult;
        return jaxbElement.getValue();
    }
    @SuppressWarnings("unchecked")
    T jaxbResult = (T) result.getResult();
    return jaxbResult;
}
 
开发者ID:MyCoRe-Org,项目名称:mycore,代码行数:19,代码来源:MCRXSL2JAXBTransformer.java

示例3: write

import javax.xml.bind.util.JAXBResult; //导入方法依赖的package包/类
@Deprecated
public void write(DigitalObjectHandler handler, ModsDefinition mods, String model, long timestamp, String message) throws DigitalObjectException {
    try {
        JAXBSource jaxbSource = new JAXBSource(ModsUtils.defaultMarshaller(false),
                new cz.cas.lib.proarc.mods.ObjectFactory().createMods(mods));
        // DO NOT include schemaLocation. Fedora validator does not accept it.
        Transformer t = DcUtils.modsTransformer(model);
        EditorResult result = editor.createResult();
        JAXBResult jaxbResult = new JAXBResult(DcUtils.defaultUnmarshaller());
        t.transform(jaxbSource, jaxbResult);
        JAXBElement<OaiDcType> elm = (JAXBElement<OaiDcType>) jaxbResult.getResult();
        OaiDcType dc = elm.getValue();
        addDigitalObjectMetadata(handler, dc);
        DcUtils.marshal(result, dc, false);
        editor.write(result, timestamp, message);
    } catch (TransformerException | JAXBException ex) {
        throw new DigitalObjectException(object.getPid(), ex);
    }
}
 
开发者ID:proarc,项目名称:proarc,代码行数:20,代码来源:DcStreamEditor.java

示例4: readAsJAXB

import javax.xml.bind.util.JAXBResult; //导入方法依赖的package包/类
public <T> T readAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
    try {
        JAXBResult r = new JAXBResult(unmarshaller);
        // bridge marshals a fragment, so we need to add start/endDocument by ourselves
        r.getHandler().startDocument();
        bridge.marshal(jaxbObject,r);
        r.getHandler().endDocument();
        return (T)r.getResult();
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:JAXBHeader.java

示例5: transformToObject

import javax.xml.bind.util.JAXBResult; //导入方法依赖的package包/类
public static <T> T transformToObject(File file, final String xslID, Class<T> targetClass, Class<?>... nestedClasses) throws TransformerException, SAXException, IOException, ParserConfigurationException, JAXBException{
	JAXBContext jc = createJAXBContext(merge(targetClass, nestedClasses));
	JAXBResult result = new JAXBResult(jc);  
	XslTransformer.transform(file, xslID, result);
	// obtain the unmarshalled content tree
	@SuppressWarnings("unchecked")
	T object = (T) result.getResult();
	return object;
}
 
开发者ID:Transkribus,项目名称:TranskribusCore,代码行数:10,代码来源:JaxbUtils.java

示例6: readPayloadAsJAXB

import javax.xml.bind.util.JAXBResult; //导入方法依赖的package包/类
public <T> T readPayloadAsJAXB(Unmarshaller unmarshaller) throws JAXBException {
    JAXBResult out = new JAXBResult(unmarshaller);
    // since the bridge only produces fragments, we need to fire start/end document.
    try {
        out.getHandler().startDocument();
        bridge.marshal(jaxbObject,out);
        out.getHandler().endDocument();
    } catch (SAXException e) {
        throw new JAXBException(e);
    }
    return (T)out.getResult();
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:13,代码来源:JAXBMessage.java


注:本文中的javax.xml.bind.util.JAXBResult.getResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。