< prev index next >

src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java

Print this page

        

*** 31,41 **** import javax.xml.validation.Schema; import java.io.File; /** * <p> ! * The <tt>Marshaller</tt> class is responsible for governing the process * of serializing Java content trees back into XML data. It provides the basic * marshalling methods: * * <p> * <i>Assume the following setup code for all following code fragments:</i> --- 31,41 ---- import javax.xml.validation.Schema; import java.io.File; /** * <p> ! * The {@code Marshaller} class is responsible for governing the process * of serializing Java content trees back into XML data. It provides the basic * marshalling methods: * * <p> * <i>Assume the following setup code for all following code fragments:</i>
*** 151,178 **** * <p> * <a name="elementMarshalling"></a> * <b>Marshalling content tree rooted by a JAXB element</b><br> * <blockquote> * The first parameter of the overloaded ! * <tt>Marshaller.marshal(java.lang.Object, ...)</tt> methods must be a * JAXB element as computed by * {@link JAXBIntrospector#isElement(java.lang.Object)}; ! * otherwise, a <tt>Marshaller.marshal</tt> method must throw a * {@link MarshalException}. There exist two mechanisms * to enable marshalling an instance that is not a JAXB element. * One method is to wrap the instance as a value of a {@link JAXBElement}, * and pass the wrapper element as the first parameter to ! * a <tt>Marshaller.marshal</tt> method. For java to schema binding, it * is also possible to simply annotate the instance's class with * @{@link XmlRootElement}. * </blockquote> * * <p> * <b>Encoding</b><br> * <blockquote> * By default, the Marshaller will use UTF-8 encoding when generating XML data ! * to a <tt>java.io.OutputStream</tt>, or a <tt>java.io.Writer</tt>. Use the * {@link #setProperty(String,Object) setProperty} API to change the output * encoding used during these marshal operations. Client applications are * expected to supply a valid character encoding name as defined in the * <a href="http://www.w3.org/TR/2000/REC-xml-20001006#charencoding">W3C XML 1.0 * Recommendation</a> and supported by your Java Platform. --- 151,178 ---- * <p> * <a name="elementMarshalling"></a> * <b>Marshalling content tree rooted by a JAXB element</b><br> * <blockquote> * The first parameter of the overloaded ! * {@code Marshaller.marshal(java.lang.Object, ...)} methods must be a * JAXB element as computed by * {@link JAXBIntrospector#isElement(java.lang.Object)}; ! * otherwise, a {@code Marshaller.marshal} method must throw a * {@link MarshalException}. There exist two mechanisms * to enable marshalling an instance that is not a JAXB element. * One method is to wrap the instance as a value of a {@link JAXBElement}, * and pass the wrapper element as the first parameter to ! * a {@code Marshaller.marshal} method. For java to schema binding, it * is also possible to simply annotate the instance's class with * @{@link XmlRootElement}. * </blockquote> * * <p> * <b>Encoding</b><br> * <blockquote> * By default, the Marshaller will use UTF-8 encoding when generating XML data ! * to a {@code java.io.OutputStream}, or a {@code java.io.Writer}. Use the * {@link #setProperty(String,Object) setProperty} API to change the output * encoding used during these marshal operations. Client applications are * expected to supply a valid character encoding name as defined in the * <a href="http://www.w3.org/TR/2000/REC-xml-20001006#charencoding">W3C XML 1.0 * Recommendation</a> and supported by your Java Platform.
*** 186,196 **** * to calling any of the marshal API's. Furthermore, there is no requirement * that the Java content tree be valid with respect to its original schema in * order to marshal it back into XML data. Different JAXB Providers will * support marshalling invalid Java content trees at varying levels, however * all JAXB Providers must be able to marshal a valid content tree back to ! * XML data. A JAXB Provider must throw a <tt>MarshalException</tt> when it * is unable to complete the marshal operation due to invalid content. Some * JAXB Providers will fully allow marshalling invalid content, others will fail * on the first validation error. * <p> * Even when schema validation is not explictly enabled for the marshal operation, --- 186,196 ---- * to calling any of the marshal API's. Furthermore, there is no requirement * that the Java content tree be valid with respect to its original schema in * order to marshal it back into XML data. Different JAXB Providers will * support marshalling invalid Java content trees at varying levels, however * all JAXB Providers must be able to marshal a valid content tree back to ! * XML data. A JAXB Provider must throw a {@code MarshalException} when it * is unable to complete the marshal operation due to invalid content. Some * JAXB Providers will fully allow marshalling invalid content, others will fail * on the first validation error. * <p> * Even when schema validation is not explictly enabled for the marshal operation,
*** 211,253 **** * <blockquote> * <p> * All JAXB Providers are required to support the following set of properties. * Some providers may support additional properties. * <dl> ! * <dt><tt>jaxb.encoding</tt> - value must be a java.lang.String</dt> * <dd>The output encoding to use when marshalling the XML data. The * Marshaller will use "UTF-8" by default if this property is not * specified.</dd> ! * <dt><tt>jaxb.formatted.output</tt> - value must be a java.lang.Boolean</dt> * <dd>This property controls whether or not the Marshaller will format * the resulting XML data with line breaks and indentation. A * true value for this property indicates human readable indented * xml data, while a false value indicates unformatted xml data. * The Marshaller will default to false (unformatted) if this * property is not specified.</dd> ! * <dt><tt>jaxb.schemaLocation</tt> - value must be a java.lang.String</dt> * <dd>This property allows the client application to specify an * xsi:schemaLocation attribute in the generated XML data. The format of * the schemaLocation attribute value is discussed in an easy to * understand, non-normative form in * <a href="http://www.w3.org/TR/xmlschema-0/#schemaLocation">Section 5.6 * of the W3C XML Schema Part 0: Primer</a> and specified in * <a href="http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions"> * Section 2.6 of the W3C XML Schema Part 1: Structures</a>.</dd> ! * <dt><tt>jaxb.noNamespaceSchemaLocation</tt> - value must be a java.lang.String</dt> * <dd>This property allows the client application to specify an * xsi:noNamespaceSchemaLocation attribute in the generated XML * data. The format of the schemaLocation attribute value is discussed in * an easy to understand, non-normative form in * <a href="http://www.w3.org/TR/xmlschema-0/#schemaLocation">Section 5.6 * of the W3C XML Schema Part 0: Primer</a> and specified in * <a href="http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions"> * Section 2.6 of the W3C XML Schema Part 1: Structures</a>.</dd> ! * <dt><tt>jaxb.fragment</tt> - value must be a java.lang.Boolean</dt> * <dd>This property determines whether or not document level events will be * generated by the Marshaller. If the property is not specified, the ! * default is <tt>false</tt>. This property has different implications depending * on which marshal api you are using - when this property is set to true:<br> * <ul> * <li>{@link #marshal(Object,org.xml.sax.ContentHandler) marshal(Object,ContentHandler)} - the Marshaller won't * invoke {@link org.xml.sax.ContentHandler#startDocument()} and * {@link org.xml.sax.ContentHandler#endDocument()}.</li> --- 211,253 ---- * <blockquote> * <p> * All JAXB Providers are required to support the following set of properties. * Some providers may support additional properties. * <dl> ! * <dt>{@code jaxb.encoding} - value must be a java.lang.String</dt> * <dd>The output encoding to use when marshalling the XML data. The * Marshaller will use "UTF-8" by default if this property is not * specified.</dd> ! * <dt>{@code jaxb.formatted.output} - value must be a java.lang.Boolean</dt> * <dd>This property controls whether or not the Marshaller will format * the resulting XML data with line breaks and indentation. A * true value for this property indicates human readable indented * xml data, while a false value indicates unformatted xml data. * The Marshaller will default to false (unformatted) if this * property is not specified.</dd> ! * <dt>{@code jaxb.schemaLocation} - value must be a java.lang.String</dt> * <dd>This property allows the client application to specify an * xsi:schemaLocation attribute in the generated XML data. The format of * the schemaLocation attribute value is discussed in an easy to * understand, non-normative form in * <a href="http://www.w3.org/TR/xmlschema-0/#schemaLocation">Section 5.6 * of the W3C XML Schema Part 0: Primer</a> and specified in * <a href="http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions"> * Section 2.6 of the W3C XML Schema Part 1: Structures</a>.</dd> ! * <dt>{@code jaxb.noNamespaceSchemaLocation} - value must be a java.lang.String</dt> * <dd>This property allows the client application to specify an * xsi:noNamespaceSchemaLocation attribute in the generated XML * data. The format of the schemaLocation attribute value is discussed in * an easy to understand, non-normative form in * <a href="http://www.w3.org/TR/xmlschema-0/#schemaLocation">Section 5.6 * of the W3C XML Schema Part 0: Primer</a> and specified in * <a href="http://www.w3.org/TR/xmlschema-1/#Instance_Document_Constructions"> * Section 2.6 of the W3C XML Schema Part 1: Structures</a>.</dd> ! * <dt>{@code jaxb.fragment} - value must be a java.lang.Boolean</dt> * <dd>This property determines whether or not document level events will be * generated by the Marshaller. If the property is not specified, the ! * default is {@code false}. This property has different implications depending * on which marshal api you are using - when this property is set to true:<br> * <ul> * <li>{@link #marshal(Object,org.xml.sax.ContentHandler) marshal(Object,ContentHandler)} - the Marshaller won't * invoke {@link org.xml.sax.ContentHandler#startDocument()} and * {@link org.xml.sax.ContentHandler#endDocument()}.</li>
*** 350,479 **** */ public static final String JAXB_FRAGMENT = "jaxb.fragment"; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into the specified ! * <tt>javax.xml.transform.Result</tt>. * * <p> * All JAXB Providers must at least support * {@link javax.xml.transform.dom.DOMResult}, * {@link javax.xml.transform.sax.SAXResult}, and * {@link javax.xml.transform.stream.StreamResult}. It can ! * support other derived classes of <tt>Result</tt> as well. * * @param jaxbElement * The root of content tree to be marshalled. * @param result * XML will be sent to this Result * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, javax.xml.transform.Result result ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into an output stream. * * @param jaxbElement * The root of content tree to be marshalled. * @param os * XML will be added to this stream. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, java.io.OutputStream os ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into a file. * * @param jaxbElement * The root of content tree to be marshalled. * @param output * File to be written. If this file already exists, it will be overwritten. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null * @since 1.6, JAXB 2.1 */ public void marshal( Object jaxbElement, File output ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into a Writer. * * @param jaxbElement * The root of content tree to be marshalled. * @param writer * XML will be sent to this writer. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, java.io.Writer writer ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into SAX2 events. * * @param jaxbElement * The root of content tree to be marshalled. * @param handler * XML will be sent to this handler as SAX2 events. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, org.xml.sax.ContentHandler handler ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into a DOM tree. * * @param jaxbElement * The content tree to be marshalled. * @param node * DOM nodes will be added as children of this node. --- 350,479 ---- */ public static final String JAXB_FRAGMENT = "jaxb.fragment"; /** ! * Marshal the content tree rooted at {@code jaxbElement} into the specified ! * {@code javax.xml.transform.Result}. * * <p> * All JAXB Providers must at least support * {@link javax.xml.transform.dom.DOMResult}, * {@link javax.xml.transform.sax.SAXResult}, and * {@link javax.xml.transform.stream.StreamResult}. It can ! * support other derived classes of {@code Result} as well. * * @param jaxbElement * The root of content tree to be marshalled. * @param result * XML will be sent to this Result * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, javax.xml.transform.Result result ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into an output stream. * * @param jaxbElement * The root of content tree to be marshalled. * @param os * XML will be added to this stream. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, java.io.OutputStream os ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into a file. * * @param jaxbElement * The root of content tree to be marshalled. * @param output * File to be written. If this file already exists, it will be overwritten. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null * @since 1.6, JAXB 2.1 */ public void marshal( Object jaxbElement, File output ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into a Writer. * * @param jaxbElement * The root of content tree to be marshalled. * @param writer * XML will be sent to this writer. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, java.io.Writer writer ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into SAX2 events. * * @param jaxbElement * The root of content tree to be marshalled. * @param handler * XML will be sent to this handler as SAX2 events. * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, org.xml.sax.ContentHandler handler ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into a DOM tree. * * @param jaxbElement * The content tree to be marshalled. * @param node * DOM nodes will be added as children of this node.
*** 484,505 **** * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>jaxbElement</tt> (or any ! * object reachable from <tt>jaxbElement</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, org.w3c.dom.Node node ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into a * {@link javax.xml.stream.XMLStreamWriter}. * * @param jaxbElement * The content tree to be marshalled. * @param writer --- 484,505 ---- * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any ! * object reachable from {@code jaxbElement}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null */ public void marshal( Object jaxbElement, org.w3c.dom.Node node ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into a * {@link javax.xml.stream.XMLStreamWriter}. * * @param jaxbElement * The content tree to be marshalled. * @param writer
*** 507,529 **** * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null * @since 1.6, JAXB 2.0 */ public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer ) throws JAXBException; /** ! * Marshal the content tree rooted at <tt>jaxbElement</tt> into a * {@link javax.xml.stream.XMLEventWriter}. * * @param jaxbElement * The content tree rooted at jaxbElement to be marshalled. * @param writer --- 507,529 ---- * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null * @since 1.6, JAXB 2.0 */ public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer ) throws JAXBException; /** ! * Marshal the content tree rooted at {@code jaxbElement} into a * {@link javax.xml.stream.XMLEventWriter}. * * @param jaxbElement * The content tree rooted at jaxbElement to be marshalled. * @param writer
*** 531,543 **** * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its <tt>handleEvent</tt> method or the ! * <tt>Marshaller</tt> is unable to marshal <tt>obj</tt> (or any ! * object reachable from <tt>obj</tt>). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null * @since 1.6, JAXB 2.0 */ --- 531,543 ---- * * @throws JAXBException * If any unexpected problem occurs during the marshalling. * @throws MarshalException * If the {@link ValidationEventHandler ValidationEventHandler} ! * returns false from its {@code handleEvent} method or the ! * {@code Marshaller} is unable to marshal {@code obj} (or any ! * object reachable from {@code obj}). See <a href="#elementMarshalling"> * Marshalling a JAXB element</a>. * @throws IllegalArgumentException * If any of the method parameters are null * @since 1.6, JAXB 2.0 */
*** 570,580 **** public org.w3c.dom.Node getNode( java.lang.Object contentTree ) throws JAXBException; /** * Set the particular property in the underlying implementation of ! * <tt>Marshaller</tt>. This method can only be used to set one of * the standard JAXB defined properties above or a provider specific * property. Attempting to set an undefined property will result in * a PropertyException being thrown. See <a href="#supportedProps"> * Supported Properties</a>. * --- 570,580 ---- public org.w3c.dom.Node getNode( java.lang.Object contentTree ) throws JAXBException; /** * Set the particular property in the underlying implementation of ! * {@code Marshaller}. This method can only be used to set one of * the standard JAXB defined properties above or a provider specific * property. Attempting to set an undefined property will result in * a PropertyException being thrown. See <a href="#supportedProps"> * Supported Properties</a>. *
*** 591,601 **** public void setProperty( String name, Object value ) throws PropertyException; /** * Get the particular property in the underlying implementation of ! * <tt>Marshaller</tt>. This method can only be used to get one of * the standard JAXB defined properties above or a provider specific * property. Attempting to get an undefined property will result in * a PropertyException being thrown. See <a href="#supportedProps"> * Supported Properties</a>. * --- 591,601 ---- public void setProperty( String name, Object value ) throws PropertyException; /** * Get the particular property in the underlying implementation of ! * {@code Marshaller}. This method can only be used to get one of * the standard JAXB defined properties above or a provider specific * property. Attempting to get an undefined property will result in * a PropertyException being thrown. See <a href="#supportedProps"> * Supported Properties</a>. *
*** 646,656 **** /** * Associates a configured instance of {@link XmlAdapter} with this marshaller. * * <p> ! * This is a convenience method that invokes <code>setAdapter(adapter.getClass(),adapter);</code>. * * @see #setAdapter(Class,XmlAdapter) * @throws IllegalArgumentException * if the adapter parameter is null. * @throws UnsupportedOperationException --- 646,656 ---- /** * Associates a configured instance of {@link XmlAdapter} with this marshaller. * * <p> ! * This is a convenience method that invokes {@code setAdapter(adapter.getClass(),adapter);}. * * @see #setAdapter(Class,XmlAdapter) * @throws IllegalArgumentException * if the adapter parameter is null. * @throws UnsupportedOperationException
*** 722,732 **** * * <p> * This method allows the caller to validate the marshalled XML as it's marshalled. * * <p> ! * Initially this property is set to <tt>null</tt>. * * @param schema Schema object to validate marshal operations against or null to disable validation * @throws UnsupportedOperationException could be thrown if this method is * invoked on an Marshaller created from a JAXBContext referencing * JAXB 1.0 mapped classes --- 722,732 ---- * * <p> * This method allows the caller to validate the marshalled XML as it's marshalled. * * <p> ! * Initially this property is set to {@code null}. * * @param schema Schema object to validate marshal operations against or null to disable validation * @throws UnsupportedOperationException could be thrown if this method is * invoked on an Marshaller created from a JAXBContext referencing * JAXB 1.0 mapped classes
*** 769,797 **** * @since 1.6, JAXB 2.0 */ public static abstract class Listener { /** * <p> ! * Callback method invoked before marshalling from <tt>source</tt> to XML. * </p> * <p> ! * This method is invoked just before marshalling process starts to marshal <tt>source</tt>. ! * Note that if the class of <tt>source</tt> defines its own <tt>beforeMarshal</tt> method, * the class specific callback method is invoked just before this method is invoked. * * @param source instance of JAXB mapped class prior to marshalling from it. */ public void beforeMarshal(Object source) { } /** * <p> ! * Callback method invoked after marshalling <tt>source</tt> to XML. * </p> * <p> ! * This method is invoked after <tt>source</tt> and all its descendants have been marshalled. ! * Note that if the class of <tt>source</tt> defines its own <tt>afterMarshal</tt> method, * the class specific callback method is invoked just before this method is invoked. * * @param source instance of JAXB mapped class after marshalling it. */ public void afterMarshal(Object source) { --- 769,797 ---- * @since 1.6, JAXB 2.0 */ public static abstract class Listener { /** * <p> ! * Callback method invoked before marshalling from {@code source} to XML. * </p> * <p> ! * This method is invoked just before marshalling process starts to marshal {@code source}. ! * Note that if the class of {@code source} defines its own {@code beforeMarshal} method, * the class specific callback method is invoked just before this method is invoked. * * @param source instance of JAXB mapped class prior to marshalling from it. */ public void beforeMarshal(Object source) { } /** * <p> ! * Callback method invoked after marshalling {@code source} to XML. * </p> * <p> ! * This method is invoked after {@code source} and all its descendants have been marshalled. ! * Note that if the class of {@code source} defines its own {@code afterMarshal} method, * the class specific callback method is invoked just before this method is invoked. * * @param source instance of JAXB mapped class after marshalling it. */ public void afterMarshal(Object source) {
*** 802,821 **** * <p> * Register marshal event callback {@link Listener} with this {@link Marshaller}. * * <p> * There is only one Listener per Marshaller. Setting a Listener replaces the previous set Listener. ! * One can unregister current Listener by setting listener to <tt>null</tt>. * * @param listener an instance of a class that implements {@link Listener} * @since 1.6, JAXB 2.0 */ public void setListener(Listener listener); /** * <p>Return {@link Listener} registered with this {@link Marshaller}. * ! * @return registered {@link Listener} or <code>null</code> if no Listener is registered with this Marshaller. * @since 1.6, JAXB 2.0 */ public Listener getListener(); } --- 802,822 ---- * <p> * Register marshal event callback {@link Listener} with this {@link Marshaller}. * * <p> * There is only one Listener per Marshaller. Setting a Listener replaces the previous set Listener. ! * One can unregister current Listener by setting listener to {@code null}. * * @param listener an instance of a class that implements {@link Listener} * @since 1.6, JAXB 2.0 */ public void setListener(Listener listener); /** * <p>Return {@link Listener} registered with this {@link Marshaller}. * ! * @return registered {@link Listener} or {@code null} ! * if no Listener is registered with this Marshaller. * @since 1.6, JAXB 2.0 */ public Listener getListener(); }
< prev index next >