JAXB
v0.21

javax.xml.bind
Class Marshaller

java.lang.Object
  |
  +--javax.xml.bind.Marshaller

public final class Marshaller
extends Object

A marshaller governs the process of marshalling a valid content tree into an XML document. It encapsulates the writer used during a marshalling operation, and provides the basic marshalling method.

The process of marshalling a content tree begins when one of the marshal methods of the tree's root element object is invoked. This method creates a new unmarshaller from the given writer and invokes its marshal(MarshallableObject) method, passing the root object, and then flushes the writer.

The marshalling process does not validate the content tree being marshalled, but it does require the tree to be valid. If an invalid object is detected during marshalling then a ValidationRequiredException will be thrown and the marshalling operation aborted. This may cause an incomplete XML document to be written; to avoid that, ensure that the content tree is valid before invoking a marshal method.

Version:
1.10, 01/05/31
See Also:
MarshallableObject, MarshallableRootElement, XMLWriter

Method Summary
 void marshal(MarshallableObject mob)
          Marshals the given marshallable object using this marshaller's writer.
 XMLWriter writer()
          Returns the writer to be used during this marshalling operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

marshal

public void marshal(MarshallableObject mob)
             throws IOException
Marshals the given marshallable object using this marshaller's writer.

This method invokes the given object's marshal(Marshaller) method, passing this marshaller.

Throws:
IOException - If an I/O error occurs
ValidationRequiredException - If the given object requires validation

writer

public XMLWriter writer()
Returns the writer to be used during this marshalling operation.
Returns:
The writer

JAXB
v0.21


Comments to: jaxb-comments@java.sun.com
More information at: http://java.sun.com/xml/jaxb

Copyright © 2001 by Sun Microsystems, Inc., 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.