Top Description Methods
jakarta.xml.bind.annotation

public Interface DomHandler<ElementT, ResultT extends javax.xml.transform.Result>

Known Direct Implementers
jakarta.xml.bind.annotation.W3CDomHandler
Imports
jakarta.xml.bind.ValidationEventHandler, javax.xml.transform.Result, .Source

Converts an element (and its descendants) from/to DOM (or similar) representation.

Implementations of this interface will be used in conjunction with XmlAnyElement annotation to map an element of XML into a representation of infoset such as W3C DOM.

Implementations hide how a portion of XML is converted into/from such DOM-like representation, allowing Jakarta XML Binding providers to work with arbitrary such library.

This interface is intended to be implemented by library writers and consumed by Jakarta XML Binding providers. None of those methods are intended to be called from applications.

Author
Kohsuke Kawaguchi
Since
1.6, JAXB 2.0

Method Summary

Modifier and TypeMethod and Description
public ResultT

Returns:

null if the operation fails. The error must have been reported to the error handler.
createUnmarshaller
(ValidationEventHandler
if any error happens between the invocation of this method and the invocation of getElement(Result), they must be reported to this handler. The caller must provide a non-null error handler. The Result object created from this method may hold a reference to this error handler.
errorHandler
)

When a Jakarta XML Binding provider needs to unmarshal a part of a document into an infoset representation, it first calls this method to create a Result object.

public ElementT

Returns:

null if the operation fails. The error must have been reported to the error handler.
getElement
(ResultT rt)

Once the portion is sent to the Result.

public Source

Returns:

null if there was an error. The error should have been reported to the handler.
marshal
(ElementT n, ValidationEventHandler
Receives any errors happened during the process of converting an element into a Source. The caller must provide a non-null error handler.
errorHandler
)

This method is called when a Jakarta XML Binding provider needs to marshal an element to XML.

Method Detail

createUnmarshallerback to summary
public ResultT createUnmarshaller(ValidationEventHandler errorHandler)

When a Jakarta XML Binding provider needs to unmarshal a part of a document into an infoset representation, it first calls this method to create a Result object.

A Jakarta XML Binding provider will then send a portion of the XML into the given result. Such a portion always form a subtree of the whole XML document rooted at an element.

Parameters
errorHandler:ValidationEventHandler

if any error happens between the invocation of this method and the invocation of getElement(Result), they must be reported to this handler. The caller must provide a non-null error handler. The Result object created from this method may hold a reference to this error handler.

Returns:ResultT

null if the operation fails. The error must have been reported to the error handler.

getElementback to summary
public ElementT getElement(ResultT rt)

Once the portion is sent to the Result. This method is called by a Jakarta XML Binding provider to obtain the unmarshalled element representation.

Multiple invocations of this method may return different objects. This method can be invoked only when the whole sub-tree are fed to the Result object.

Parameters
rt:ResultT

The Result object created by createUnmarshaller(ValidationEventHandler).

Returns:ElementT

null if the operation fails. The error must have been reported to the error handler.

marshalback to summary
public Source marshal(ElementT n, ValidationEventHandler errorHandler)

This method is called when a Jakarta XML Binding provider needs to marshal an element to XML.

If non-null, the returned Source must contain a whole document rooted at one element, which will then be weaved into a bigger document that the Jakarta XML Binding provider is marshalling.

Parameters
errorHandler:ValidationEventHandler

Receives any errors happened during the process of converting an element into a Source. The caller must provide a non-null error handler.

Returns:Source

null if there was an error. The error should have been reported to the handler.