public class DOMResult
extends Object implements Result
| java.lang.Object | |
| javax.xml.transform.dom.DOMResult | |
充当文档对象模型(DOM)树形式的转换结果树的持有者。
如果未设置输出DOM源,则转换将创建一个Document节点作为转换结果的持有者,可以使用 getNode()检索该 getNode() 。
常量(Constants) |
|
|---|---|
String |
FEATURE 如果 |
Inherited constants |
|---|
javax.xml.transform.Result
|
Public constructors |
|
|---|---|
DOMResult() 零参数默认构造函数。 |
|
DOMResult(Node node) 使用DOM节点来创建新的输出目标。 |
|
DOMResult(Node node, String systemId) 使用DOM节点创建具有指定系统ID的新输出目标。 |
|
DOMResult(Node node, Node nextSibling) 使用DOM节点创建一个新的输出目标,指定之前要插入结果节点的子节点。 |
|
DOMResult(Node node, Node nextSibling, String systemId) 使用DOM节点创建新的输出目标,指定之前要插入结果节点的子节点以及指定的系统ID。 |
|
公共方法(Public methods) |
|
|---|---|
Node |
getNextSibling() 获取将在其之前插入结果节点的子节点。 |
Node |
getNode() 获取将包含结果DOM树的节点。 |
String |
getSystemId() 获取系统标识符。 |
void |
setNextSibling(Node nextSibling) 设置将在其之前插入结果节点的子节点。 |
void |
setNode(Node node) 设置将包含结果DOM树的节点。 |
void |
setSystemId(String systemId) 设置可能与节点关联使用的systemId。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
javax.xml.transform.Result
|
|
String FEATURE
如果 getFeature(String)在将此值作为参数传递时返回 true ,则 Transformer支持此类型的 Result输出。
常量值:“http://javax.xml.transform.dom.DOMResult/feature”
DOMResult (Node node)
使用DOM节点来创建新的输出目标。
实际上,节点应该是Document节点, DocumentFragment节点或Element节点。 换句话说,一个接受孩子的节点。
siblingNode和 systemId将设置为 null 。
| 参数(Parameters) | |
|---|---|
node |
Node: The DOM node that will contain the result tree. |
DOMResult (Node node, String systemId)
使用DOM节点创建具有指定系统ID的新输出目标。
实际上,节点应该是Document节点, DocumentFragment节点或Element节点。 换句话说,一个接受孩子的节点。
siblingNode将被设置为 null 。
| 参数(Parameters) | |
|---|---|
node |
Node: The DOM node that will contain the result tree. |
systemId |
String: The system identifier which may be used in association with this node. |
DOMResult (Node node, Node nextSibling)
使用DOM节点创建一个新的输出目标,指定之前要插入结果节点的子节点。
实际上, node和nextSibling应该是Document节点, DocumentFragment节点或Element节点。 换句话说,一个接受孩子的节点。
使用nextSibling指定之前应插入结果节点的子节点。 如果nextSibling不是nextSibling的兄弟, node抛出IllegalArgumentException 。 如果node是null而nextSibling不是null ,则引发IllegalArgumentException 。 如果nextSibling是null ,那么行为与调用DOMResult(Node)相同,即追加结果节点作为指定的node的最后一个孩子。
systemId将被设置为 null 。
| 参数(Parameters) | |
|---|---|
node |
Node: The DOM node that will contain the result tree. |
nextSibling |
Node: The child node where the result nodes should be inserted before. |
| 抛出异常(Throws) | |
|---|---|
IllegalArgumentException |
If nextSibling is not a sibling of node. |
IllegalArgumentException |
If node is null and nextSibling is not null. |
DOMResult (Node node, Node nextSibling, String systemId)
使用DOM节点创建新的输出目标,指定之前要插入结果节点的子节点以及指定的系统ID。
实际上, node和nextSibling应该是Document节点, DocumentFragment节点或Element节点。 换句话说,一个接受孩子的节点。
使用nextSibling指定之前应插入结果节点的子节点。 如果nextSibling不是nextSibling的兄弟, node抛出IllegalArgumentException 。 如果node是null而nextSibling不是null ,则引发IllegalArgumentException 。 如果nextSibling是null ,那么行为与调用DOMResult(Node, String)相同,即追加结果节点作为指定节点的最后一个子节点并使用指定的系统ID。
| 参数(Parameters) | |
|---|---|
node |
Node: The DOM node that will contain the result tree. |
nextSibling |
Node: The child node where the result nodes should be inserted before. |
systemId |
String: The system identifier which may be used in association with this node. |
| 抛出异常(Throws) | |
|---|---|
IllegalArgumentException |
If nextSibling is not a sibling of node. |
IllegalArgumentException |
If node is null and nextSibling is not null. |
Node getNextSibling ()
获取将在其之前插入结果节点的子节点。
If no node was set via DOMResult(Node, Node), DOMResult(Node, Node, String) or setNextSibling(Node), then null will be returned.
| 返回(Returns) | |
|---|---|
Node |
The child node before which the result nodes will be inserted. |
Node getNode ()
获取将包含结果DOM树的节点。
如果没有节点经由设置DOMResult(Node) , DOMResult(Node, String) , DOMResult(Node, Node) , DOMResult(Node, Node, String)或setNode(Node) ,那么该节点将会通过变换设置,一旦改造完成后可以从该方法获得的。 在转换之前调用此方法将返回null 。
| 返回(Returns) | |
|---|---|
Node |
The node to which the transformation will be appended. |
String getSystemId ()
获取系统标识符。
如果没有通过 DOMResult(Node, String)或 setSystemId(String)设置系统ID, DOMResult(Node, Node, String)返回 null 。
| 返回(Returns) | |
|---|---|
String |
The system identifier. |
void setNextSibling (Node nextSibling)
设置将在其之前插入结果节点的子节点。
使用nextSibling指定应在其之前插入结果节点的子节点。 如果nextSibling不是nextSibling的后代, node抛出IllegalArgumentException 。 如果node是null而nextSibling不是null ,则引发IllegalStateException 。 如果nextSibling是null ,那么行为与调用DOMResult(Node)相同, DOMResult(Node)结果节点附加为指定的node的最后一个孩子。
| 参数(Parameters) | |
|---|---|
nextSibling |
Node: The child node before which the result nodes will be inserted. |
| 抛出异常(Throws) | |
|---|---|
IllegalArgumentException |
If nextSibling is not a descendant of node. |
IllegalStateException |
If node is null and nextSibling is not null. |
void setNode (Node node)
设置将包含结果DOM树的节点。
实际上,节点应该是Document节点, DocumentFragment节点或Element节点。 换句话说,一个接受孩子的节点。
一个IllegalStateException如果抛出nextSibling不null和node不是父nextSibling 。 一个IllegalStateException如果抛出node为null和nextSibling不null 。
| 参数(Parameters) | |
|---|---|
node |
Node: The node to which the transformation will be appended. |
| 抛出异常(Throws) | |
|---|---|
IllegalStateException |
If nextSibling is not null and nextSibling is not a child of node. |
IllegalStateException |
If node is null and nextSibling is not null. |
void setSystemId (String systemId)
设置可能与节点关联使用的systemId。
| 参数(Parameters) | |
|---|---|
systemId |
String: The system identifier as a URI string. |