Please note that you may need to call flush() on the underlying XMLStreamWriter or XMLEventWriter after the transform is complete.
The fact that JAXBResult derives from SAXResult is an implementation detail.
The fact that StAXSource derives from SAXSource is an implementation detail.