use of com.sun.xml.stream.buffer.XMLStreamBufferResult in project metro-jax-ws by eclipse-ee4j.
the class JAXBMessage method readPayload.
@Override
public XMLStreamReader readPayload() throws XMLStreamException {
try {
if (infoset == null) {
if (rawContext != null) {
XMLStreamBufferResult sbr = new XMLStreamBufferResult();
Marshaller m = rawContext.createMarshaller();
m.setProperty("jaxb.fragment", Boolean.TRUE);
m.marshal(jaxbObject, sbr);
infoset = sbr.getXMLStreamBuffer();
} else {
MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer();
writePayloadTo(buffer.createFromXMLStreamWriter());
infoset = buffer;
}
}
XMLStreamReader reader = infoset.readAsXMLStreamReader();
if (reader.getEventType() == XMLStreamConstants.START_DOCUMENT)
XMLStreamReaderUtil.nextElementContent(reader);
return reader;
} catch (JAXBException e) {
// bug 6449684, spec 4.3.4
throw new WebServiceException(e);
}
}
Aggregations