return new JAXBBridgeSource(bridge,jaxbObject);
}
@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();
}