<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Sat Dec 04 05:26:32 UTC 2010 --> <TITLE> Marshaller </TITLE> <META NAME="date" CONTENT="2010-12-04"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Marshaller"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><B>PREV CLASS</B></A> <A HREF="../../../javax/xml/bind/NotIdentifiableEvent.html" title="interface in javax.xml.bind"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/bind/Marshaller.html" target="_top"><B>FRAMES</B></A> <A HREF="Marshaller.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> javax.xml.bind</FONT> <BR> Interface Marshaller</H2> <DL> <DT><B>All Known Subinterfaces:</B> <DD><A HREF="../../../org/apache/ws/jaxme/JMMarshaller.html" title="interface in org.apache.ws.jaxme">JMMarshaller</A></DD> </DL> <DL> <DT><B>All Known Implementing Classes:</B> <DD><A HREF="../../../javax/xml/bind/helpers/AbstractMarshallerImpl.html" title="class in javax.xml.bind.helpers">AbstractMarshallerImpl</A>, <A HREF="../../../org/apache/ws/jaxme/impl/JMMarshallerImpl.html" title="class in org.apache.ws.jaxme.impl">JMMarshallerImpl</A></DD> </DL> <HR> <DL> <DT><PRE>public interface <B>Marshaller</B></DL> </PRE> <P> <p>An instance of <code>Marshaller</code> may be obtained by the JAXB user to serialize JAXB objects to various flavours of XML. The created XML may be: <table border="1"> <tr><th>A byte stream<br><CODE>OutputStream</CODE></th> <td><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.OutputStream)"><CODE>marshal(Object, java.io.OutputStream)</CODE></A></td> </tr> <tr><th>A character stream<br><CODE>Writer</CODE></th> <td><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.Writer)"><CODE>marshal(Object, java.io.Writer)</CODE></A></td> </tr> </table> <P> <P> <DL> <DT><B>Since:</B></DT> <DD>JAXB1.0</DD> <DT><B>Author:</B></DT> <DD>JSR-31</DD> </DL> <HR> <P> <!-- =========== FIELD SUMMARY =========== --> <A NAME="field_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Field Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING">JAXB_ENCODING</A></B></CODE> <BR> Name of the property that allows to choose the encoding.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT">JAXB_FORMATTED_OUTPUT</A></B></CODE> <BR> Name of the property that allows to choose whether the generated XML should be formatted (human readable, indented) or not.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION">JAXB_NO_NAMESPACE_SCHEMA_LOCATION</A></B></CODE> <BR> If this property is set to another value than null, then the <code>Marshaller</code> will create an attribute <samp>xsi:noNamespaceSchemaLocation</samp>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static java.lang.String</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION">JAXB_SCHEMA_LOCATION</A></B></CODE> <BR> If this property is set to another value than null, then the <code>Marshaller</code> will create an attribute <samp>xsi:schemaLocation</samp>.</TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> <A HREF="../../../javax/xml/bind/ValidationEventHandler.html" title="interface in javax.xml.bind">ValidationEventHandler</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#getEventHandler()">getEventHandler</A></B>()</CODE> <BR> Returns an event handler previously registered by the application.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> org.w3c.dom.Node</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#getNode(java.lang.Object)">getNode</A></B>(java.lang.Object pObject)</CODE> <BR> Returns a DOM view of the given JAXB object.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.lang.Object</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#getProperty(java.lang.String)">getProperty</A></B>(java.lang.String pName)</CODE> <BR> Returns the value of the marshaller property <code>pName</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, org.xml.sax.ContentHandler)">marshal</A></B>(java.lang.Object pObject, org.xml.sax.ContentHandler pTarget)</CODE> <BR> Marshals the given JAXB object by emitting SAX events into into the given SAX <CODE>ContentHandler</CODE>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, org.w3c.dom.Node)">marshal</A></B>(java.lang.Object pObject, org.w3c.dom.Node pTarget)</CODE> <BR> Marshals the given JAXB object by creating a DOM tree below the given node.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.OutputStream)">marshal</A></B>(java.lang.Object pObject, java.io.OutputStream pTarget)</CODE> <BR> Marshals the given JAXB object <code>pObject</code> and serializes it into the byte stream <code>pTarget</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, javax.xml.transform.Result)">marshal</A></B>(java.lang.Object pObject, javax.xml.transform.Result pTarget)</CODE> <BR> Marshals the given JAXB object <code>pObject</code> to the <CODE>Result</CODE> <code>pTarget</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.Writer)">marshal</A></B>(java.lang.Object pObject, java.io.Writer pTarget)</CODE> <BR> Marshals the given JAXB object <code>pObject</code> and serializes it into the character stream <code>pTarget</code>.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#setEventHandler(javax.xml.bind.ValidationEventHandler)">setEventHandler</A></B>(<A HREF="../../../javax/xml/bind/ValidationEventHandler.html" title="interface in javax.xml.bind">ValidationEventHandler</A> pHandler)</CODE> <BR> Allows the application to set an event handler.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../javax/xml/bind/Marshaller.html#setProperty(java.lang.String, java.lang.Object)">setProperty</A></B>(java.lang.String pName, java.lang.Object pValue)</CODE> <BR> Sets the marshaller property <code>pName</code> to the value <code>pValue</code>.</TD> </TR> </TABLE> <P> <!-- ============ FIELD DETAIL =========== --> <A NAME="field_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Field Detail</B></FONT></TH> </TR> </TABLE> <A NAME="JAXB_ENCODING"><!-- --></A><H3> JAXB_ENCODING</H3> <PRE> static final java.lang.String <B>JAXB_ENCODING</B></PRE> <DL> <DD><p>Name of the property that allows to choose the encoding. The encoding applies when marshalling to an <CODE>OutputStream</CODE>, to a <CODE>Writer</CODE>, or to a <CODE>StreamResult</CODE>. It is ignored, if the target is a <CODE>ContentHandler</CODE>, a DOM <CODE>Node</CODE>, or another flavour of <CODE>Result</CODE>.</p> <p>The encoding may be used both to choose the characters being escaped (as <samp>&#ddd;</samp>) or to convert characters into byte sequences.</p> <p>The property value is the encoding name, for example <samp>UTF-8</samp>, which is the default. Note, that a JAXB implementation need not support other encodings than <samp>UTF-8</samp>, <samp>UTF-16</samp>, and <samp>US-ASCII</samp>. Usually you may expect that the encodings supported by the JVM itself will work for the <code>Marshaller</code> as well.</p> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.OutputStream)"><CODE>marshal(Object, java.io.OutputStream)</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.Writer)"><CODE>marshal(Object, java.io.Writer)</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, javax.xml.transform.Result)"><CODE>marshal(Object, javax.xml.transform.Result)</CODE></A>, <A HREF="../../../constant-values.html#javax.xml.bind.Marshaller.JAXB_ENCODING">Constant Field Values</A></DL> </DL> <HR> <A NAME="JAXB_FORMATTED_OUTPUT"><!-- --></A><H3> JAXB_FORMATTED_OUTPUT</H3> <PRE> static final java.lang.String <B>JAXB_FORMATTED_OUTPUT</B></PRE> <DL> <DD><p>Name of the property that allows to choose whether the generated XML should be formatted (human readable, indented) or not. By default the generated XML is formatted. The property value is an instance of <CODE>Boolean</CODE>, by default <CODE>Boolean.TRUE</CODE>.</p> <p>The formatting property is supported when marshalling to a character or byte stream. It is ignored, if the target is a <CODE>ContentHandler</CODE>, a DOM <CODE>Node</CODE>, or an instance of <CODE>Result</CODE>, the exception being a <CODE>StreamResult</CODE>, which is in fact a character or byte stream.</p> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.OutputStream)"><CODE>marshal(Object, java.io.OutputStream)</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.Writer)"><CODE>marshal(Object, java.io.Writer)</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, javax.xml.transform.Result)"><CODE>marshal(Object, javax.xml.transform.Result)</CODE></A>, <A HREF="../../../constant-values.html#javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT">Constant Field Values</A></DL> </DL> <HR> <A NAME="JAXB_SCHEMA_LOCATION"><!-- --></A><H3> JAXB_SCHEMA_LOCATION</H3> <PRE> static final java.lang.String <B>JAXB_SCHEMA_LOCATION</B></PRE> <DL> <DD><p>If this property is set to another value than null, then the <code>Marshaller</code> will create an attribute <samp>xsi:schemaLocation</samp>. The attribute value is the property value. By default the property is set to null and no such attribute is generated.</p> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><CODE>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../constant-values.html#javax.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION">Constant Field Values</A></DL> </DL> <HR> <A NAME="JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><!-- --></A><H3> JAXB_NO_NAMESPACE_SCHEMA_LOCATION</H3> <PRE> static final java.lang.String <B>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</B></PRE> <DL> <DD><p>If this property is set to another value than null, then the <code>Marshaller</code> will create an attribute <samp>xsi:noNamespaceSchemaLocation</samp>. The attribute value is the property value. By default the property is set to null and no such attribute is generated.</p> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION"><CODE>JAXB_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../constant-values.html#javax.xml.bind.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION">Constant Field Values</A></DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="marshal(java.lang.Object, javax.xml.transform.Result)"><!-- --></A><H3> marshal</H3> <PRE> void <B>marshal</B>(java.lang.Object pObject, javax.xml.transform.Result pTarget) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Marshals the given JAXB object <code>pObject</code> to the <CODE>Result</CODE> <code>pTarget</code>. All JAXB provider must support <CODE>DOMResult</CODE>, <CODE>SAXResult</CODE>, and <CODE>StreamResult</CODE>, which can easily be mapped to <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, org.w3c.dom.Node)"><CODE>marshal(Object, org.w3c.dom.Node)</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, org.xml.sax.ContentHandler)"><CODE>marshal(Object, org.xml.sax.ContentHandler)</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.OutputStream)"><CODE>marshal(Object,java.io.OutputStream)</CODE></A>, or <A HREF="../../../javax/xml/bind/Marshaller.html#marshal(java.lang.Object, java.io.Writer)"><CODE>marshal(Object,java.io.Writer)</CODE></A>. The use of a <CODE>Result</CODE> as a target isn't portable beyond these subinterfaces.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pObject</CODE> - The JAXB object being marshalled.<DD><CODE>pTarget</CODE> - The <CODE>Result</CODE> being created. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An unexcpected problem occurred. This may be used, for example, to throw a nested <CODE>IOException</CODE>. <DD><CODE><A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind">MarshalException</A></CODE> - Whereever possible, one should throw a <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><CODE>MarshalException</CODE></A>, and not a <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind"><CODE>JAXBException</CODE></A>. <DD><CODE>java.lang.IllegalArgumentException</CODE> - Any of the parameters was null.<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION"><CODE>JAXB_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><CODE>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</CODE></A></DL> </DD> </DL> <HR> <A NAME="marshal(java.lang.Object, java.io.OutputStream)"><!-- --></A><H3> marshal</H3> <PRE> void <B>marshal</B>(java.lang.Object pObject, java.io.OutputStream pTarget) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Marshals the given JAXB object <code>pObject</code> and serializes it into the byte stream <code>pTarget</code>. Note, that serialization into a byte stream demands the use of an encoding. It may be required to set the parameter <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING"><CODE>JAXB_ENCODING</CODE></A>. By default the created output is formatted, which may be turned off using <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT"><CODE>JAXB_FORMATTED_OUTPUT</CODE></A>.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pObject</CODE> - The JAXB object being marshalled.<DD><CODE>pTarget</CODE> - The output byte stream. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An unexpected problem occurred. This may be used, for example, to throw a nested <CODE>IOException</CODE>. <DD><CODE><A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind">MarshalException</A></CODE> - Whereever possible, one should prefer the <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><CODE>MarshalException</CODE></A> over the <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind"><CODE>JAXBException</CODE></A>. <DD><CODE>java.lang.IllegalArgumentException</CODE> - Any of the parameters was null.<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING"><CODE>JAXB_ENCODING</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT"><CODE>JAXB_FORMATTED_OUTPUT</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><CODE>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION"><CODE>JAXB_SCHEMA_LOCATION</CODE></A></DL> </DD> </DL> <HR> <A NAME="marshal(java.lang.Object, java.io.Writer)"><!-- --></A><H3> marshal</H3> <PRE> void <B>marshal</B>(java.lang.Object pObject, java.io.Writer pTarget) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Marshals the given JAXB object <code>pObject</code> and serializes it into the character stream <code>pTarget</code>. Unlike serialization to a byte stream, an encoding is not required, but a <code>Marshaller</code> may use the encoding whether to escape a character or not. Use of the <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING"><CODE>JAXB_ENCODING</CODE></A> property is still recommended. By default the created output is formatted, which may be turned off using <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT"><CODE>JAXB_FORMATTED_OUTPUT</CODE></A>.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pObject</CODE> - The JAXB object being marshalled.<DD><CODE>pTarget</CODE> - The output character stream. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An unexpected problem occurred. This may be used, for example, to throw a nested <CODE>IOException</CODE>. <DD><CODE><A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind">MarshalException</A></CODE> - Whereever possible, one should prefer the <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><CODE>MarshalException</CODE></A> over the <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind"><CODE>JAXBException</CODE></A>. <DD><CODE>java.lang.IllegalArgumentException</CODE> - Any of the parameters was null.<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING"><CODE>JAXB_ENCODING</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT"><CODE>JAXB_FORMATTED_OUTPUT</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><CODE>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION"><CODE>JAXB_SCHEMA_LOCATION</CODE></A></DL> </DD> </DL> <HR> <A NAME="marshal(java.lang.Object, org.xml.sax.ContentHandler)"><!-- --></A><H3> marshal</H3> <PRE> void <B>marshal</B>(java.lang.Object pObject, org.xml.sax.ContentHandler pTarget) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Marshals the given JAXB object by emitting SAX events into into the given SAX <CODE>ContentHandler</CODE>. This includes the events <CODE>ContentHandler.startDocument()</CODE> and <CODE>ContentHandler.endDocument()</CODE>.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pObject</CODE> - The JAXB Object being marshalled.<DD><CODE>pTarget</CODE> - The target event handler. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An unexpected problem occurred. This may be used, for example, to throw a nested <CODE>SAXException</CODE>. <DD><CODE><A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind">MarshalException</A></CODE> - Whereever possible, one should prefer the <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><CODE>MarshalException</CODE></A> over the <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind"><CODE>JAXBException</CODE></A>. <DD><CODE>java.lang.IllegalArgumentException</CODE> - Any of the parameters was null.<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><CODE>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION"><CODE>JAXB_SCHEMA_LOCATION</CODE></A></DL> </DD> </DL> <HR> <A NAME="marshal(java.lang.Object, org.w3c.dom.Node)"><!-- --></A><H3> marshal</H3> <PRE> void <B>marshal</B>(java.lang.Object pObject, org.w3c.dom.Node pTarget) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Marshals the given JAXB object by creating a DOM tree below the given node.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pObject</CODE> - The JAXB object being marshalled.<DD><CODE>pTarget</CODE> - The target node. This node must be ready to accept a child element. For example, it may be a <CODE>Document</CODE>, a <CODE>DocumentFragment</CODE>, or an <CODE>Element</CODE>. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An unexpected problem occurred. This may be used, for example, to throw a nested <CODE>DOMException</CODE>. <DD><CODE><A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind">MarshalException</A></CODE> - Whereever possible, one should prefer the <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><CODE>MarshalException</CODE></A> over the <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind"><CODE>JAXBException</CODE></A>. <DD><CODE>java.lang.IllegalArgumentException</CODE> - Any of the parameters was null.<DT><B>See Also:</B><DD><A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION"><CODE>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</CODE></A>, <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION"><CODE>JAXB_SCHEMA_LOCATION</CODE></A></DL> </DD> </DL> <HR> <A NAME="getNode(java.lang.Object)"><!-- --></A><H3> getNode</H3> <PRE> org.w3c.dom.Node <B>getNode</B>(java.lang.Object pObject) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Returns a DOM view of the given JAXB object. This view is life in the sense that modifications of its DOM tree will trigger updates on the original JAXB object.</p> <p><em>Note</em>: This is an optional feature and not supported by all JAXB providers.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pObject</CODE> - The JAXB object being viewed. <DT><B>Throws:</B> <DD><CODE>java.lang.UnsupportedOperationException</CODE> - The JAXB provider does not support DOM views. <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An unexpected problem occurred. This may be used, for example, to throw a nested <CODE>DOMException</CODE>. <DD><CODE>java.lang.IllegalArgumentException</CODE> - The parameter was null.</DL> </DD> </DL> <HR> <A NAME="setProperty(java.lang.String, java.lang.Object)"><!-- --></A><H3> setProperty</H3> <PRE> void <B>setProperty</B>(java.lang.String pName, java.lang.Object pValue) throws <A HREF="../../../javax/xml/bind/PropertyException.html" title="class in javax.xml.bind">PropertyException</A></PRE> <DL> <DD><p>Sets the marshaller property <code>pName</code> to the value <code>pValue</code>. Note, that the value type depends on the property being set. For example, the property <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING"><CODE>JAXB_ENCODING</CODE></A> requires a string, but the property <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT"><CODE>JAXB_FORMATTED_OUTPUT</CODE></A> requires a <CODE>Boolean</CODE>.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pName</CODE> - The property name. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/PropertyException.html" title="class in javax.xml.bind">PropertyException</A></CODE> - An error occurred while processing the property. <DD><CODE>java.lang.IllegalArgumentException</CODE> - The name parameter was null.</DL> </DD> </DL> <HR> <A NAME="getProperty(java.lang.String)"><!-- --></A><H3> getProperty</H3> <PRE> java.lang.Object <B>getProperty</B>(java.lang.String pName) throws <A HREF="../../../javax/xml/bind/PropertyException.html" title="class in javax.xml.bind">PropertyException</A></PRE> <DL> <DD><p>Returns the value of the marshaller property <code>pName</code>. Note, that the value type depends on the property being set. For example, the property <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_ENCODING"><CODE>JAXB_ENCODING</CODE></A> requires a string, but the property <A HREF="../../../javax/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT"><CODE>JAXB_FORMATTED_OUTPUT</CODE></A> requires a <CODE>Boolean</CODE>.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pName</CODE> - The property name. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/PropertyException.html" title="class in javax.xml.bind">PropertyException</A></CODE> - An error occurred while processing the property. <DD><CODE>java.lang.IllegalArgumentException</CODE> - The name parameter was null.</DL> </DD> </DL> <HR> <A NAME="setEventHandler(javax.xml.bind.ValidationEventHandler)"><!-- --></A><H3> setEventHandler</H3> <PRE> void <B>setEventHandler</B>(<A HREF="../../../javax/xml/bind/ValidationEventHandler.html" title="interface in javax.xml.bind">ValidationEventHandler</A> pHandler) throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Allows the application to set an event handler. The event handler will be invoked in case of a validation event.</p> <p><em>Note</em>: The ability to register an event handler does not indicate that a JAXB provider is required to validate the objects being marshalled. If you want to ensure, that only valid objects are marshalled, you should perform an explicit validation using a <A HREF="../../../javax/xml/bind/Validator.html" title="interface in javax.xml.bind"><CODE>Validator</CODE></A>.</p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>pHandler</CODE> - An application specific event handler or null to revert to the default event handler. The default handler is throwing an exception in case of errors. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE></DL> </DD> </DL> <HR> <A NAME="getEventHandler()"><!-- --></A><H3> getEventHandler</H3> <PRE> <A HREF="../../../javax/xml/bind/ValidationEventHandler.html" title="interface in javax.xml.bind">ValidationEventHandler</A> <B>getEventHandler</B>() throws <A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></PRE> <DL> <DD><p>Returns an event handler previously registered by the application. The event handler will be invoked in case of a validation event.</p> <p><em>Note</em>: The ability to register an event handler does not indicate that a JAXB provider is required to validate the objects being marshalled. If you want to ensure, that only valid objects are marshalled, you should perform an explicit validation using a <A HREF="../../../javax/xml/bind/Validator.html" title="interface in javax.xml.bind"><CODE>Validator</CODE></A>.</p> <P> <DD><DL> <DT><B>Returns:</B><DD>An event handler previously set by the application or the default event handler. The default handler is simply throwing exceptions. <DT><B>Throws:</B> <DD><CODE><A HREF="../../../javax/xml/bind/JAXBException.html" title="class in javax.xml.bind">JAXBException</A></CODE> - An error occurred while getting the event handler.</DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/xml/bind/MarshalException.html" title="class in javax.xml.bind"><B>PREV CLASS</B></A> <A HREF="../../../javax/xml/bind/NotIdentifiableEvent.html" title="interface in javax.xml.bind"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?javax/xml/bind/Marshaller.html" target="_top"><B>FRAMES</B></A> <A HREF="Marshaller.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: <A HREF="#field_detail">FIELD</A> | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>