How to Send the Content Tree to a DOM/SAX Consumer
The Marshaller interface provides several ways of interoperating with code that expects XML as a DOM tree or is implemented as SAX ContentHandler.
MovieLibrary library = new MovieLibrary();
Marshaller m = ...;
// Writing into a DOM tree
Document doc = ...; // DOM Document
m.marshal(library, doc); // write into the given DOM node
// Writing to a SAX ContentHandler
ContentHandler handler = ...;
marshal(library, handler); // write into ContentHandler
In addition to the marshal variants, there is also the optional operation getNode, which would return a live DOM tree corrensponding to the JAXB content tree. Java's default implemention does not support this operation though.

