W3CDomHandler (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.xml.bind.annotation Class W3CDomHandler

java.lang.Object
  extended by javax.xml.bind.annotation.W3CDomHandler
所有已实现的接口:
DomHandler<Element,DOMResult>

public class W3CDomHandler
extends Object
implements DomHandler<Element,DOMResult>

DomHandler implementation for W3C DOM (org.w3c.dom package.)

从以下版本开始:
JAXB2.0
作者:
Kohsuke Kawaguchi

构造器摘要
W3CDomHandler()
          Default constructor.
W3CDomHandler(DocumentBuilder builder)
          Constructor that allows applications to specify which DOM implementation to be used.
 
方法摘要
 DOMResult createUnmarshaller(ValidationEventHandler errorHandler)
          When a JAXB provider needs to unmarshal a part of a document into an infoset representation, it first calls this method to create a Result object.
 DocumentBuilder getBuilder()
           
 Element getElement(DOMResult r)
          Once the portion is sent to the Result.
 Source marshal(Element element, ValidationEventHandler errorHandler)
          This method is called when a JAXB provider needs to marshal an element to XML.
 void setBuilder(DocumentBuilder builder)
           
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造器详细信息

W3CDomHandler

public W3CDomHandler()
Default constructor. It is up to a JAXB 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.

参数:
builder - must not be null. JAXB uses this DocumentBuilder to create a new element.

方法详细信息

getBuilder

public DocumentBuilder getBuilder()

setBuilder

public void setBuilder(DocumentBuilder builder)

createUnmarshaller

public DOMResult createUnmarshaller(ValidationEventHandler errorHandler)
Description copied from interface: DomHandler
When a JAXB provider needs to unmarshal a part of a document into an infoset representation, it first calls this method to create a Result object.

A JAXB 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.

规范说明:
createUnmarshaller in interface DomHandler<Element,DOMResult>
参数:
errorHandler - if any error happens between the invocation of this method and the invocation of DomHandler.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.
返回:
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: DomHandler
Once the portion is sent to the Result. This method is called by a JAXB 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.

规范说明:
getElement in interface DomHandler<Element,DOMResult>
参数:
r - The Result object created by DomHandler.createUnmarshaller(ValidationEventHandler).
返回:
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: DomHandler
This method is called when a JAXB 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 JAXB provider is marshalling.

规范说明:
marshal in interface DomHandler<Element,DOMResult>
errorHandler - Receives any errors happened during the process of converting an element into a Source. The caller must provide a non-null error handler.
返回:
null if there was an error. The error should have been reported to the handler.

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.