blob: 043d96af64c68dc7f5e35ad27e108e6ef811e2f3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>Marshaller</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Marshaller";
}
}
catch(err) {
}
//-->
var methods = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6,"i7":6,"i8":6,"i9":6,"i10":6,"i11":6,"i12":6,"i13":6,"i14":6,"i15":6,"i16":6,"i17":6,"i18":6,"i19":6,"i20":6,"i21":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?jakarta/xml/bind/Marshaller.html" target="_top">Frames</a></li>
<li><a href="Marshaller.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">jakarta.xml.bind</div>
<h2 title="Interface Marshaller" class="title">Interface Marshaller</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Known Implementing Classes:</dt>
<dd><a href="../../../jakarta/xml/bind/helpers/AbstractMarshallerImpl.html" title="class in jakarta.xml.bind.helpers">AbstractMarshallerImpl</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="typeNameLabel">Marshaller</span></pre>
<div class="block"><p>
The <code>Marshaller</code> 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>
<blockquote>
<pre>
JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
Unmarshaller u = jc.createUnmarshaller();
Object element = u.unmarshal( new File( "foo.xml" ) );
Marshaller m = jc.createMarshaller();
</pre>
</blockquote>
<p>
Marshalling to a File:
<blockquote>
<pre>
OutputStream os = new FileOutputStream( "nosferatu.xml" );
m.marshal( element, os );
</pre>
</blockquote>
<p>
Marshalling to a SAX ContentHandler:
<blockquote>
<pre>
// assume MyContentHandler instanceof ContentHandler
m.marshal( element, new MyContentHandler() );
</pre>
</blockquote>
<p>
Marshalling to a DOM Node:
<blockquote>
<pre>
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.newDocument();
m.marshal( element, doc );
</pre>
</blockquote>
<p>
Marshalling to a java.io.OutputStream:
<blockquote>
<pre>
m.marshal( element, System.out );
</pre>
</blockquote>
<p>
Marshalling to a java.io.Writer:
<blockquote>
<pre>
m.marshal( element, new PrintWriter( System.out ) );
</pre>
</blockquote>
<p>
Marshalling to a javax.xml.transform.SAXResult:
<blockquote>
<pre>
// assume MyContentHandler instanceof ContentHandler
SAXResult result = new SAXResult( new MyContentHandler() );
m.marshal( element, result );
</pre>
</blockquote>
<p>
Marshalling to a javax.xml.transform.DOMResult:
<blockquote>
<pre>
DOMResult result = new DOMResult();
m.marshal( element, result );
</pre>
</blockquote>
<p>
Marshalling to a javax.xml.transform.StreamResult:
<blockquote>
<pre>
StreamResult result = new StreamResult( System.out );
m.marshal( element, result );
</pre>
</blockquote>
<p>
Marshalling to a javax.xml.stream.XMLStreamWriter:
<blockquote>
<pre>
XMLStreamWriter xmlStreamWriter =
XMLOutputFactory.newInstance().createXMLStreamWriter( ... );
m.marshal( element, xmlStreamWriter );
</pre>
</blockquote>
<p>
Marshalling to a javax.xml.stream.XMLEventWriter:
<blockquote>
<pre>
XMLEventWriter xmlEventWriter =
XMLOutputFactory.newInstance().createXMLEventWriter( ... );
m.marshal( element, xmlEventWriter );
</pre>
</blockquote>
<p>
<a id="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, ...)</code> methods must be a
JAXB element as computed by
<a href="../../../jakarta/xml/bind/JAXBIntrospector.html#isElement-java.lang.Object-"><code>JAXBIntrospector.isElement(java.lang.Object)</code></a>;
otherwise, a <code>Marshaller.marshal</code> method must throw a
<a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind"><code>MarshalException</code></a>. 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 <a href="../../../jakarta/xml/bind/JAXBElement.html" title="class in jakarta.xml.bind"><code>JAXBElement</code></a>,
and pass the wrapper element as the first parameter to
a <code>Marshaller.marshal</code> method. For java to schema binding, it
is also possible to simply annotate the instance's class with
&#64;<a href="../../../jakarta/xml/bind/annotation/XmlRootElement.html" title="annotation in jakarta.xml.bind.annotation"><code>XmlRootElement</code></a>.
</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</code>, or a <code>java.io.Writer</code>. Use the
<a href="../../../jakarta/xml/bind/Marshaller.html#setProperty-java.lang.String-java.lang.Object-"><code>setProperty</code></a> 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.
</blockquote>
<p>
<b>Validation and Well-Formedness</b><br>
<blockquote>
<p>
Client applications are not required to validate the Java content tree prior
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</code> 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,
it is possible that certain types of validation events will be detected
during the operation. Validation events will be reported to the registered
event handler. If the client application has not registered an event handler
prior to invoking one of the marshal API's, then events will be delivered to
a default event handler which will terminate the marshal operation after
encountering the first error or fatal error. Note that for JAXB 2.0 and
later versions, <a href="../../../jakarta/xml/bind/helpers/DefaultValidationEventHandler.html" title="class in jakarta.xml.bind.helpers"><code>DefaultValidationEventHandler</code></a> is
no longer used.
</blockquote>
<p>
<a id="supportedProps"></a>
<b>Supported Properties</b><br>
<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</code> - 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</code> - 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</code> - 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</code> - 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</code> - 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</code>. This property has different implications depending
on which marshal api you are using - when this property is set to true:<br>
<ul>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-org.xml.sax.ContentHandler-"><code>marshal(Object,ContentHandler)</code></a> - the Marshaller won't
invoke <code>ContentHandler.startDocument()</code> and
<code>ContentHandler.endDocument()</code>.</li>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-org.w3c.dom.Node-"><code>marshal(Object,Node)</code></a> - the property has no effect on this
API.</li>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-java.io.OutputStream-"><code>marshal(Object,OutputStream)</code></a> - the Marshaller won't
generate an xml declaration.</li>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-java.io.Writer-"><code>marshal(Object,Writer)</code></a> - the Marshaller won't
generate an xml declaration.</li>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-javax.xml.transform.Result-"><code>marshal(Object,Result)</code></a> - depends on the kind of
Result object, see semantics for Node, ContentHandler, and Stream APIs</li>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-javax.xml.stream.XMLEventWriter-"><code>marshal(Object,XMLEventWriter)</code></a> - the
Marshaller will not generate <code>XMLStreamConstants.START_DOCUMENT</code> and
<code>XMLStreamConstants.END_DOCUMENT</code> events.</li>
<li><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-javax.xml.stream.XMLStreamWriter-"><code>marshal(Object,XMLStreamWriter)</code></a> - the
Marshaller will not generate <code>XMLStreamConstants.START_DOCUMENT</code> and
<code>XMLStreamConstants.END_DOCUMENT</code> events.</li>
</ul>
</dd>
</dl>
</blockquote>
<p>
<a id="marshalEventCallback"></a>
<b>Marshal Event Callbacks</b><br>
<blockquote>
"The <a href="../../../jakarta/xml/bind/Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a> provides two styles of callback mechanisms
that allow application specific processing during key points in the
unmarshalling process. In 'class defined' event callbacks, application
specific code placed in JAXB mapped classes is triggered during
marshalling. 'External listeners' allow for centralized processing
of marshal events in one callback method rather than by type event callbacks.
<p>
Class defined event callback methods allow any JAXB mapped class to specify
its own specific callback methods by defining methods with the following method signatures:
<blockquote>
<pre>
// Invoked by Marshaller after it has created an instance of this object.
boolean beforeMarshal(Marshaller);
// Invoked by Marshaller after it has marshalled all properties of this object.
void afterMarshal(Marshaller);
</pre>
</blockquote>
The class defined event callback methods should be used when the callback method requires
access to non-public methods and/or fields of the class.
<p>
The external listener callback mechanism enables the registration of a <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a>
instance with a <a href="../../../jakarta/xml/bind/Marshaller.html#setListener-jakarta.xml.bind.Marshaller.Listener-"><code>setListener(Listener)</code></a>. The external listener receives all callback events,
allowing for more centralized processing than per class defined callback methods.
<p>
The 'class defined' and external listener event callback methods are independent of each other,
both can be called for one event. The invocation ordering when both listener callback methods exist is
defined in <a href="../../../jakarta/xml/bind/Marshaller.Listener.html#beforeMarshal-java.lang.Object-"><code>Marshaller.Listener.beforeMarshal(Object)</code></a> and <a href="../../../jakarta/xml/bind/Marshaller.Listener.html#afterMarshal-java.lang.Object-"><code>Marshaller.Listener.afterMarshal(Object)</code></a>.
<p>
An event callback method throwing an exception terminates the current marshal process.
</blockquote></div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 1.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/xml/bind/JAXBContext.html" title="class in jakarta.xml.bind"><code>JAXBContext</code></a>,
<a href="../../../jakarta/xml/bind/Validator.html" title="interface in jakarta.xml.bind"><code>Validator</code></a>,
<a href="../../../jakarta/xml/bind/Unmarshaller.html" title="interface in jakarta.xml.bind"><code>Unmarshaller</code></a></dd>
</dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Interface and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind">Marshaller.Listener</a></span></code>
<div class="block">
Register an instance of an implementation of this class with a <a href="../../../jakarta/xml/bind/Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a> to externally listen
for marshal events.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#JAXB_ENCODING">JAXB_ENCODING</a></span></code>
<div class="block">The name of the property used to specify the output encoding in
the marshalled XML data.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#JAXB_FORMATTED_OUTPUT">JAXB_FORMATTED_OUTPUT</a></span></code>
<div class="block">The name of the property used to specify whether or not the marshalled
XML data is formatted with linefeeds and indentation.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#JAXB_FRAGMENT">JAXB_FRAGMENT</a></span></code>
<div class="block">The name of the property used to specify whether or not the marshaller
will generate document level events (ie calling startDocument or endDocument).</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#JAXB_NO_NAMESPACE_SCHEMA_LOCATION">JAXB_NO_NAMESPACE_SCHEMA_LOCATION</a></span></code>
<div class="block">The name of the property used to specify the
xsi:noNamespaceSchemaLocation attribute value to place in the marshalled
XML output.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#JAXB_SCHEMA_LOCATION">JAXB_SCHEMA_LOCATION</a></span></code>
<div class="block">The name of the property used to specify the xsi:schemaLocation
attribute value to place in the marshalled XML output.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>&lt;A extends <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters">XmlAdapter</a>&gt;<br>A</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getAdapter-java.lang.Class-">getAdapter</a></span>(java.lang.Class&lt;A&gt;&nbsp;type)</code>
<div class="block">Gets the adapter associated with the specified type.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html" title="class in jakarta.xml.bind.attachment">AttachmentMarshaller</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getAttachmentMarshaller--">getAttachmentMarshaller</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind">ValidationEventHandler</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getEventHandler--">getEventHandler</a></span>()</code>
<div class="block">Return the current event handler or the default event handler if one
hasn't been set.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind">Marshaller.Listener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getListener--">getListener</a></span>()</code>
<div class="block">Return <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a> registered with this <a href="../../../jakarta/xml/bind/Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a>.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>org.w3c.dom.Node</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getNode-java.lang.Object-">getNode</a></span>(java.lang.Object&nbsp;contentTree)</code>
<div class="block">Get a DOM tree view of the content tree(Optional).</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>java.lang.Object</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getProperty-java.lang.String-">getProperty</a></span>(java.lang.String&nbsp;name)</code>
<div class="block">Get the particular property in the underlying implementation of
<code>Marshaller</code>.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>javax.xml.validation.Schema</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#getSchema--">getSchema</a></span>()</code>
<div class="block">Get the JAXP 1.3 <code>Schema</code> object
being used to perform marshal-time validation.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-org.xml.sax.ContentHandler-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
org.xml.sax.ContentHandler&nbsp;handler)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into SAX2 events.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-java.io.File-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
java.io.File&nbsp;output)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a file.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-org.w3c.dom.Node-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
org.w3c.dom.Node&nbsp;node)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a DOM tree.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-java.io.OutputStream-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
java.io.OutputStream&nbsp;os)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into an output stream.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-javax.xml.transform.Result-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
javax.xml.transform.Result&nbsp;result)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into the specified
<code>javax.xml.transform.Result</code>.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-java.io.Writer-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
java.io.Writer&nbsp;writer)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a Writer.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-javax.xml.stream.XMLEventWriter-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
javax.xml.stream.XMLEventWriter&nbsp;writer)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a
<code>XMLEventWriter</code>.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-javax.xml.stream.XMLStreamWriter-">marshal</a></span>(java.lang.Object&nbsp;jaxbElement,
javax.xml.stream.XMLStreamWriter&nbsp;writer)</code>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a
<code>XMLStreamWriter</code>.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>&lt;A extends <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters">XmlAdapter</a>&gt;<br>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setAdapter-java.lang.Class-A-">setAdapter</a></span>(java.lang.Class&lt;A&gt;&nbsp;type,
A&nbsp;adapter)</code>
<div class="block">Associates a configured instance of <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters"><code>XmlAdapter</code></a> with this marshaller.</div>
</td>
</tr>
<tr id="i16" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setAdapter-jakarta.xml.bind.annotation.adapters.XmlAdapter-">setAdapter</a></span>(<a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters">XmlAdapter</a>&nbsp;adapter)</code>
<div class="block">Associates a configured instance of <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters"><code>XmlAdapter</code></a> with this marshaller.</div>
</td>
</tr>
<tr id="i17" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setAttachmentMarshaller-jakarta.xml.bind.attachment.AttachmentMarshaller-">setAttachmentMarshaller</a></span>(<a href="../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html" title="class in jakarta.xml.bind.attachment">AttachmentMarshaller</a>&nbsp;am)</code>
<div class="block">Associate a context that enables binary data within an XML document
to be transmitted as XML-binary optimized attachment.</div>
</td>
</tr>
<tr id="i18" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setEventHandler-jakarta.xml.bind.ValidationEventHandler-">setEventHandler</a></span>(<a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind">ValidationEventHandler</a>&nbsp;handler)</code>
<div class="block">Allow an application to register a validation event handler.</div>
</td>
</tr>
<tr id="i19" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setListener-jakarta.xml.bind.Marshaller.Listener-">setListener</a></span>(<a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind">Marshaller.Listener</a>&nbsp;listener)</code>
<div class="block">
Register marshal event callback <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a> with this <a href="../../../jakarta/xml/bind/Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a>.</div>
</td>
</tr>
<tr id="i20" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setProperty-java.lang.String-java.lang.Object-">setProperty</a></span>(java.lang.String&nbsp;name,
java.lang.Object&nbsp;value)</code>
<div class="block">Set the particular property in the underlying implementation of
<code>Marshaller</code>.</div>
</td>
</tr>
<tr id="i21" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../jakarta/xml/bind/Marshaller.html#setSchema-javax.xml.validation.Schema-">setSchema</a></span>(javax.xml.validation.Schema&nbsp;schema)</code>
<div class="block">Specify the JAXP 1.3 <code>Schema</code>
object that should be used to validate subsequent marshal operations
against.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="JAXB_ENCODING">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>JAXB_ENCODING</h4>
<pre>static final&nbsp;java.lang.String JAXB_ENCODING</pre>
<div class="block">The name of the property used to specify the output encoding in
the marshalled XML data.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.xml.bind.Marshaller.JAXB_ENCODING">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="JAXB_FORMATTED_OUTPUT">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>JAXB_FORMATTED_OUTPUT</h4>
<pre>static final&nbsp;java.lang.String JAXB_FORMATTED_OUTPUT</pre>
<div class="block">The name of the property used to specify whether or not the marshalled
XML data is formatted with linefeeds and indentation.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="JAXB_SCHEMA_LOCATION">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>JAXB_SCHEMA_LOCATION</h4>
<pre>static final&nbsp;java.lang.String JAXB_SCHEMA_LOCATION</pre>
<div class="block">The name of the property used to specify the xsi:schemaLocation
attribute value to place in the marshalled XML output.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.xml.bind.Marshaller.JAXB_SCHEMA_LOCATION">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="JAXB_NO_NAMESPACE_SCHEMA_LOCATION">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>JAXB_NO_NAMESPACE_SCHEMA_LOCATION</h4>
<pre>static final&nbsp;java.lang.String JAXB_NO_NAMESPACE_SCHEMA_LOCATION</pre>
<div class="block">The name of the property used to specify the
xsi:noNamespaceSchemaLocation attribute value to place in the marshalled
XML output.</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.xml.bind.Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION">Constant Field Values</a></dd>
</dl>
</li>
</ul>
<a name="JAXB_FRAGMENT">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>JAXB_FRAGMENT</h4>
<pre>static final&nbsp;java.lang.String JAXB_FRAGMENT</pre>
<div class="block">The name of the property used to specify whether or not the marshaller
will generate document level events (ie calling startDocument or endDocument).</div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#jakarta.xml.bind.Marshaller.JAXB_FRAGMENT">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="marshal-java.lang.Object-javax.xml.transform.Result-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
javax.xml.transform.Result&nbsp;result)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into the specified
<code>javax.xml.transform.Result</code>.
<p>
All JAXB Providers must at least support
<code>DOMResult</code>,
<code>SAXResult</code>, and
<code>StreamResult</code>. It can
support other derived classes of <code>Result</code> as well.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The root of content tree to be marshalled.</dd>
<dd><code>result</code> - XML will be sent to this Result</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-java.io.OutputStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
java.io.OutputStream&nbsp;os)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into an output stream.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The root of content tree to be marshalled.</dd>
<dd><code>os</code> - XML will be added to this stream.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-java.io.File-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
java.io.File&nbsp;output)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a file.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The root of content tree to be marshalled.</dd>
<dd><code>output</code> - File to be written. If this file already exists, it will be overwritten.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.1</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-java.io.Writer-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
java.io.Writer&nbsp;writer)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a Writer.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The root of content tree to be marshalled.</dd>
<dd><code>writer</code> - XML will be sent to this writer.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-org.xml.sax.ContentHandler-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
org.xml.sax.ContentHandler&nbsp;handler)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into SAX2 events.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The root of content tree to be marshalled.</dd>
<dd><code>handler</code> - XML will be sent to this handler as SAX2 events.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-org.w3c.dom.Node-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
org.w3c.dom.Node&nbsp;node)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a DOM tree.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The content tree to be marshalled.</dd>
<dd><code>node</code> - DOM nodes will be added as children of this node.
This parameter must be a Node that accepts children
(<code>Document</code>,
<code>DocumentFragment</code>, or
<code>Element</code>)</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-javax.xml.stream.XMLStreamWriter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
javax.xml.stream.XMLStreamWriter&nbsp;writer)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a
<code>XMLStreamWriter</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The content tree to be marshalled.</dd>
<dd><code>writer</code> - XML will be sent to this writer.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="marshal-java.lang.Object-javax.xml.stream.XMLEventWriter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>marshal</h4>
<pre>void&nbsp;marshal(java.lang.Object&nbsp;jaxbElement,
javax.xml.stream.XMLEventWriter&nbsp;writer)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Marshal the content tree rooted at <code>jaxbElement</code> into a
<code>XMLEventWriter</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>jaxbElement</code> - The content tree rooted at jaxbElement to be marshalled.</dd>
<dd><code>writer</code> - XML will be sent to this writer.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs during the marshalling.</dd>
<dd><code><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind">MarshalException</a></code> - If the <a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind"><code>ValidationEventHandler</code></a>
returns false from its <code>handleEvent</code> method or the
<code>Marshaller</code> is unable to marshal <code>jaxbElement</code> (or any
object reachable from <code>jaxbElement</code>). See <a href="#elementMarshalling">
Marshalling a JAXB element</a>.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="getNode-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNode</h4>
<pre>org.w3c.dom.Node&nbsp;getNode(java.lang.Object&nbsp;contentTree)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Get a DOM tree view of the content tree(Optional).
If the returned DOM tree is updated, these changes are also
visible in the content tree.
Use <a href="../../../jakarta/xml/bind/Marshaller.html#marshal-java.lang.Object-org.w3c.dom.Node-"><code>marshal(Object, org.w3c.dom.Node)</code></a> to force
a deep copy of the content tree to a DOM representation.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>contentTree</code> - - JAXB Java representation of XML content</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the DOM tree view of the contentTree</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.UnsupportedOperationException</code> - If the JAXB provider implementation does not support a
DOM view of the content tree</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If any of the method parameters are null</dd>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - If any unexpected problem occurs</dd>
</dl>
</li>
</ul>
<a name="setProperty-java.lang.String-java.lang.Object-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setProperty</h4>
<pre>void&nbsp;setProperty(java.lang.String&nbsp;name,
java.lang.Object&nbsp;value)
throws <a href="../../../jakarta/xml/bind/PropertyException.html" title="class in jakarta.xml.bind">PropertyException</a></pre>
<div class="block">Set the particular property in the underlying implementation of
<code>Marshaller</code>. 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>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the property to be set. This value can either
be specified using one of the constant fields or a user
supplied string.</dd>
<dd><code>value</code> - the value of the property to be set</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/PropertyException.html" title="class in jakarta.xml.bind">PropertyException</a></code> - when there is an error processing the given
property or value</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If the name parameter is null</dd>
</dl>
</li>
</ul>
<a name="getProperty-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProperty</h4>
<pre>java.lang.Object&nbsp;getProperty(java.lang.String&nbsp;name)
throws <a href="../../../jakarta/xml/bind/PropertyException.html" title="class in jakarta.xml.bind">PropertyException</a></pre>
<div class="block">Get the particular property in the underlying implementation of
<code>Marshaller</code>. 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>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the property to retrieve</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the value of the requested property</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/PropertyException.html" title="class in jakarta.xml.bind">PropertyException</a></code> - when there is an error retrieving the given property or value
property name</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If the name parameter is null</dd>
</dl>
</li>
</ul>
<a name="setEventHandler-jakarta.xml.bind.ValidationEventHandler-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setEventHandler</h4>
<pre>void&nbsp;setEventHandler(<a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind">ValidationEventHandler</a>&nbsp;handler)
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Allow an application to register a validation event handler.
<p>
The validation event handler will be called by the JAXB Provider if any
validation errors are encountered during calls to any of the marshal
API's. If the client application does not register a validation event
handler before invoking one of the marshal methods, then validation
events will be handled by the default event handler which will terminate
the marshal operation after the first error or fatal error is encountered.
<p>
Calling this method with a null parameter will cause the Marshaller
to revert back to the default default event handler.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>handler</code> - the validation event handler</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while setting the
event handler</dd>
</dl>
</li>
</ul>
<a name="getEventHandler--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getEventHandler</h4>
<pre><a href="../../../jakarta/xml/bind/ValidationEventHandler.html" title="interface in jakarta.xml.bind">ValidationEventHandler</a>&nbsp;getEventHandler()
throws <a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></pre>
<div class="block">Return the current event handler or the default event handler if one
hasn't been set.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the current ValidationEventHandler or the default event handler
if it hasn't been set</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../jakarta/xml/bind/JAXBException.html" title="class in jakarta.xml.bind">JAXBException</a></code> - if an error was encountered while getting the
current event handler</dd>
</dl>
</li>
</ul>
<a name="setAdapter-jakarta.xml.bind.annotation.adapters.XmlAdapter-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAdapter</h4>
<pre>void&nbsp;setAdapter(<a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters">XmlAdapter</a>&nbsp;adapter)</pre>
<div class="block">Associates a configured instance of <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters"><code>XmlAdapter</code></a> with this marshaller.
<p>
This is a convenience method that invokes <code>setAdapter(adapter.getClass(),adapter);</code>.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the adapter parameter is null.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if invoked agains a JAXB 1.0 implementation.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../jakarta/xml/bind/Marshaller.html#setAdapter-java.lang.Class-A-"><code>setAdapter(Class,XmlAdapter)</code></a></dd>
</dl>
</li>
</ul>
<a name="setAdapter-java.lang.Class-jakarta.xml.bind.annotation.adapters.XmlAdapter-">
<!-- -->
</a><a name="setAdapter-java.lang.Class-A-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAdapter</h4>
<pre>&lt;A extends <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters">XmlAdapter</a>&gt;&nbsp;void&nbsp;setAdapter(java.lang.Class&lt;A&gt;&nbsp;type,
A&nbsp;adapter)</pre>
<div class="block">Associates a configured instance of <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters"><code>XmlAdapter</code></a> with this marshaller.
<p>
Every marshaller internally maintains a
<code>Map</code>&lt;<code>Class</code>,<a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters"><code>XmlAdapter</code></a>&gt;,
which it uses for marshalling classes whose fields/methods are annotated
with <a href="../../../jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html" title="annotation in jakarta.xml.bind.annotation.adapters"><code>XmlJavaTypeAdapter</code></a>.
<p>
This method allows applications to use a configured instance of <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters"><code>XmlAdapter</code></a>.
When an instance of an adapter is not given, a marshaller will create
one by invoking its default constructor.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - The type of the adapter. The specified instance will be used when
<a href="../../../jakarta/xml/bind/annotation/adapters/XmlJavaTypeAdapter.html#value--"><code>XmlJavaTypeAdapter.value()</code></a>
refers to this type.</dd>
<dd><code>adapter</code> - The instance of the adapter to be used. If null, it will un-register
the current adapter set for this type.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type parameter is null.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if invoked agains a JAXB 1.0 implementation.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="getAdapter-java.lang.Class-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAdapter</h4>
<pre>&lt;A extends <a href="../../../jakarta/xml/bind/annotation/adapters/XmlAdapter.html" title="class in jakarta.xml.bind.annotation.adapters">XmlAdapter</a>&gt;&nbsp;A&nbsp;getAdapter(java.lang.Class&lt;A&gt;&nbsp;type)</pre>
<div class="block">Gets the adapter associated with the specified type.
This is the reverse operation of the <a href="../../../jakarta/xml/bind/Marshaller.html#setAdapter-jakarta.xml.bind.annotation.adapters.XmlAdapter-"><code>setAdapter(jakarta.xml.bind.annotation.adapters.XmlAdapter)</code></a> method.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - if the type parameter is null.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if invoked agains a JAXB 1.0 implementation.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="setAttachmentMarshaller-jakarta.xml.bind.attachment.AttachmentMarshaller-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAttachmentMarshaller</h4>
<pre>void&nbsp;setAttachmentMarshaller(<a href="../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html" title="class in jakarta.xml.bind.attachment">AttachmentMarshaller</a>&nbsp;am)</pre>
<div class="block"><p>Associate a context that enables binary data within an XML document
to be transmitted as XML-binary optimized attachment.
The attachment is referenced from the XML document content model
by content-id URIs(cid) references stored within the xml document.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if attempt to concurrently call this
method during a marshal operation.</dd>
</dl>
</li>
</ul>
<a name="getAttachmentMarshaller--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAttachmentMarshaller</h4>
<pre><a href="../../../jakarta/xml/bind/attachment/AttachmentMarshaller.html" title="class in jakarta.xml.bind.attachment">AttachmentMarshaller</a>&nbsp;getAttachmentMarshaller()</pre>
</li>
</ul>
<a name="setSchema-javax.xml.validation.Schema-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setSchema</h4>
<pre>void&nbsp;setSchema(javax.xml.validation.Schema&nbsp;schema)</pre>
<div class="block">Specify the JAXP 1.3 <code>Schema</code>
object that should be used to validate subsequent marshal operations
against. Passing null into this method will disable validation.
<p>
This method allows the caller to validate the marshalled XML as it's marshalled.
<p>
Initially this property is set to <code>null</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>schema</code> - Schema object to validate marshal operations against or null to disable validation</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.UnsupportedOperationException</code> - could be thrown if this method is
invoked on an Marshaller created from a JAXBContext referencing
JAXB 1.0 mapped classes</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="getSchema--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getSchema</h4>
<pre>javax.xml.validation.Schema&nbsp;getSchema()</pre>
<div class="block">Get the JAXP 1.3 <code>Schema</code> object
being used to perform marshal-time validation. If there is no
Schema set on the marshaller, then this method will return null
indicating that marshal-time validation will not be performed.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the Schema object being used to perform marshal-time
validation or null if not present.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.UnsupportedOperationException</code> - could be thrown if this method is
invoked on an Marshaller created from a JAXBContext referencing
JAXB 1.0 mapped classes</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="setListener-jakarta.xml.bind.Marshaller.Listener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setListener</h4>
<pre>void&nbsp;setListener(<a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind">Marshaller.Listener</a>&nbsp;listener)</pre>
<div class="block"><p>
Register marshal event callback <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a> with this <a href="../../../jakarta/xml/bind/Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a>.
<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</code>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - an instance of a class that implements <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a></dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
<a name="getListener--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getListener</h4>
<pre><a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind">Marshaller.Listener</a>&nbsp;getListener()</pre>
<div class="block"><p>Return <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a> registered with this <a href="../../../jakarta/xml/bind/Marshaller.html" title="interface in jakarta.xml.bind"><code>Marshaller</code></a>.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>registered <a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><code>Marshaller.Listener</code></a> or <code>null</code>
if no Listener is registered with this Marshaller.</dd>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>1.6, JAXB 2.0</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../jakarta/xml/bind/MarshalException.html" title="class in jakarta.xml.bind"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../jakarta/xml/bind/Marshaller.Listener.html" title="class in jakarta.xml.bind"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?jakarta/xml/bind/Marshaller.html" target="_top">Frames</a></li>
<li><a href="Marshaller.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>