marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
marshaller.setAttachmentMarshaller(new AttachmentMarshallerImpl());
// It's safe to pass a stream result, because the SCE will always be in XML_VALID state afterwards.
// This state can safely be written to an outstream. See XMLFragment and XMLContent as well.
result = new BufferedStreamResult();
marshaller.marshal(new JAXBElement(xmlName, expectedType, value), result);
if (log.isDebugEnabled()) log.debug("serialized: " + result);
}
catch (Exception ex)