W3CDomHandler (Java EE 5)

Java EE API


javax.xml.bind.annotation Class W3CDomHandler

java.lang.Object
  extended by javax.xml.bind.annotation.W3CDomHandler
All Implemented Interfaces:
DomHandler<Element,DOMResult>

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

Implements: ">DomHandler

W3C DOM(org.w3c.dom 包)的 DomHandler 实现。
英文文档:

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

Since:
JAXB2.0
Author:
Kohsuke Kawaguchi

Constructor Summary
 
Method Summary
 DOMResult
 DocumentBuilder
 Element
 Source
 void
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public W3CDomHandler()
默认的构造方法。 它取决于 JAXB 提供者决定使用哪一个 DOM 实现或如何进行配置。
英文文档:

W3CDomHandler

public W3CDomHandler()
Default constructor. It is up to a JAXB provider to decide which DOM implementation to use or how that is configured.


public W3CDomHandler(javax.xml.parsers.DocumentBuilder builder)
允许应用程序指定使用哪一个 DOM 实现的构造方法。
builder 不得为 null。JAXB 使用此 DocumentBuilder 创建新的元素。
英文文档:

W3CDomHandler

public W3CDomHandler(DocumentBuilder builder)
Constructor that allows applications to specify which DOM implementation to be used.

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

Method Detail

public javax.xml.parsers.DocumentBuilder getBuilder()
英文文档:

getBuilder

public DocumentBuilder getBuilder()

public void setBuilder(javax.xml.parsers.DocumentBuilder builder)
英文文档:

setBuilder

public void setBuilder(DocumentBuilder builder)

public javax.xml.transform.dom.DOMResult createUnmarshaller(ValidationEventHandler errorHandler)
英文文档:

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.

Specified by:
createUnmarshaller in interface DomHandler<Element,DOMResult>
Parameters:
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.
Returns:
null if the operation fails. The error must have been reported to the error handler.

public org.w3c.dom.Element getElement(javax.xml.transform.dom.DOMResult r)
英文文档:

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.

Specified by:
getElement in interface DomHandler<Element,DOMResult>
Parameters:
r - The Result object created by DomHandler.createUnmarshaller(ValidationEventHandler).
Returns:
null if the operation fails. The error must have been reported to the error handler.

public javax.xml.transform.Source marshal(org.w3c.dom.Element element, ValidationEventHandler errorHandler)
英文文档:

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.

Specified by:
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.
Returns:
null if there was an error. The error should have been reported to the handler.


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!