Package jakarta.xml.bind.annotation
Class W3CDomHandler
- java.lang.Object
 - 
- jakarta.xml.bind.annotation.W3CDomHandler
 
 
- 
- All Implemented Interfaces:
 DomHandler<Element,DOMResult>
public class W3CDomHandler extends Object implements DomHandler<Element,DOMResult>
DomHandlerimplementation for W3C DOM (org.w3c.dompackage.)- Since:
 - 1.6, JAXB 2.0
 - Author:
 - Kohsuke Kawaguchi
 
 
- 
- 
Constructor Summary
Constructors Constructor Description W3CDomHandler()Default constructor.W3CDomHandler(DocumentBuilder builder)Constructor that allows applications to specify which DOM implementation to be used. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DOMResultcreateUnmarshaller(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 aResultobject.DocumentBuildergetBuilder()ElementgetElement(DOMResult r)Once the portion is sent to theResult.Sourcemarshal(Element element, ValidationEventHandler errorHandler)This method is called when a Jakarta XML Binding provider needs to marshal an element to XML.voidsetBuilder(DocumentBuilder builder) 
 - 
 
- 
- 
Constructor Detail
- 
W3CDomHandler
public W3CDomHandler()
Default constructor. It is up to a Jakarta XML Binding provider to decide which DOM implementation to use or how that is configured. 
- 
W3CDomHandler
public W3CDomHandler(DocumentBuilder builder)
Constructor that allows applications to specify which DOM implementation to be used.- Parameters:
 builder- must not be null. Jakarta XML Binding uses thisDocumentBuilderto create a new element.
 
 - 
 
- 
Method Detail
- 
getBuilder
public DocumentBuilder getBuilder()
 
- 
setBuilder
public void setBuilder(DocumentBuilder builder)
 
- 
createUnmarshaller
public DOMResult createUnmarshaller(ValidationEventHandler errorHandler)
Description copied from interface:DomHandlerWhen a Jakarta XML Binding provider needs to unmarshal a part of a document into an infoset representation, it first calls this method to create aResultobject.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.
- Specified by:
 createUnmarshallerin interfaceDomHandler<Element,DOMResult>- Parameters:
 errorHandler- if any error happens between the invocation of this method and the invocation ofDomHandler.getElement(Result), they must be reported to this handler. The caller must provide a non-null error handler. TheResultobject created from this method may hold a reference to this error handler.- Returns:
 - null if the operation fails. The error must have been reported to the error handler.
 
 
- 
getElement
public Element getElement(DOMResult r)
Description copied from interface:DomHandlerOnce the portion is sent to theResult. 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
Resultobject.- Specified by:
 getElementin interfaceDomHandler<Element,DOMResult>- Parameters:
 r- TheResultobject created byDomHandler.createUnmarshaller(ValidationEventHandler).- Returns:
 - null if the operation fails. The error must have been reported to the error handler.
 
 
- 
marshal
public Source marshal(Element element, ValidationEventHandler errorHandler)
Description copied from interface:DomHandlerThis method is called when a Jakarta XML Binding provider needs to marshal an element to XML.If non-null, the returned
Sourcemust 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.- Specified by:
 marshalin interfaceDomHandler<Element,DOMResult>errorHandler- Receives any errors happened during the process of converting an element into aSource. The caller must provide a non-null error handler.- Returns:
 - null if there was an error. The error should have been reported to the handler.
 
 
 - 
 
 -