javax.xml.bind.util
Class JAXBSource
java.lang.Object
javax.xml.transform.sax.SAXSource
javax.xml.bind.util.JAXBSource
- All Implemented Interfaces:
- javax.xml.transform.Source
- public class JAXBSource
- extends javax.xml.transform.sax.SAXSource
This utility class allows to use a JAXB object as the
source of a stylesheet transformation.
If you depend on any methods from
SAXSource, you should
use this class. In particular, you must not use the
methods
SAXSource.setInputSource(InputSource),
or
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
| Fields inherited from class javax.xml.transform.sax.SAXSource |
FEATURE |
|
Constructor Summary |
JAXBSource(JAXBContext pContext,
java.lang.Object pObject)
Creates a new instance of JAXBSource. |
JAXBSource(Marshaller pMarshaller,
java.lang.Object pObject)
Creates a new instance of JAXBSource. |
| Methods inherited from class javax.xml.transform.sax.SAXSource |
getInputSource, getSystemId, getXMLReader, setInputSource, setSystemId, setXMLReader, sourceToInputSource |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JAXBSource
public JAXBSource(JAXBContext pContext,
java.lang.Object pObject)
throws JAXBException
Creates a new instance of JAXBSource. The given
JAXBContext will be used to
construct a Marshaller and
invoke the constructor
JAXBSource(javax.xml.bind.Marshaller, Object).
JAXBSource
public JAXBSource(Marshaller pMarshaller,
java.lang.Object pObject)
throws JAXBException
Creates a new instance of JAXBSource.