javax.xml.bind.util

Class JAXBSource

public class JAXBSource extends SAXSource

This utility class allows to use a JAXB object as the source of a stylesheet transformation.
If you depend on any methods from javax.xml.transform.sax.SAXSource, you should use this class. In particular, you must not use the methods javax.xml.transform.sax.SAXSource#setInputSource(InputSource), or javax.xml.transform.sax.SAXSource#setXMLReader(XMLReader) on an instance of JAXBSource.
If you depend on these methods, a replacement for the JAXBSource can be obtained as follows:
     javax.xml.bind.JAXBContext context;
     javax.xml.bind.Element object;
     java.io.StringWriter sw = new java.io.StringWriter();
     context.createMarshaller().marshal(object, sw);
     org.xml.sax.InputSource isource = new org.xml.sax.InputSource(new java.io.StringReader(sw.toString()));
     javax.xml.transform.sax.SAXSource source = new javax.xml.transform.sax.SAXSource(isource);
 

Since: JAXB1.0

Author: JSR-31

Constructor Summary
JAXBSource(JAXBContext pContext, Object pObject)

Creates a new instance of JAXBSource.

JAXBSource(Marshaller pMarshaller, Object pObject)

Creates a new instance of JAXBSource.

Constructor Detail

JAXBSource

public JAXBSource(JAXBContext pContext, Object pObject)

Creates a new instance of JAXBSource. The given JAXBContext will be used to construct a Marshaller and invoke the constructor JAXBSource.

JAXBSource

public JAXBSource(Marshaller pMarshaller, Object pObject)

Creates a new instance of JAXBSource.