Node (Java EE 5)

Java EE API


javax.xml.soap Interface Node

All Superinterfaces:
Node
All Known Subinterfaces:
Detail, DetailEntry, SOAPBody, SOAPBodyElement, SOAPElement, SOAPEnvelope, SOAPFault, SOAPFaultElement, SOAPHeader, SOAPHeaderElement, Text

public interface Node
extends Node

Implements: org.w3c.dom.Node
Implemented by: SOAPElement, SOAPPart, Text

XML 文档中节点(元素)的表示形式。此接口扩展了标准的 DOM Node 接口,具有一些能获取和设置节点值、获取和设置父节点、移除节点的方法。
英文文档:

A representation of a node (element) in an XML document. This interface extnends the standard DOM Node interface with methods for getting and setting the value of a node, for getting and setting the parent of a node, and for removing a node.


Field Summary
 
Fields inherited from interface org.w3c.dom.Node
 
Method Summary
 void
 SOAPElement
 String
 void
 void
 void
 
Methods inherited from interface org.w3c.dom.Node
 

Method Detail

public String getValue()
如果这是一个 Text 节点,则返回此节点的值,否则返回此节点的直接子节点值。如果此 Node 有一个直接子节点是 Text 节点,则返回该直接子节点的值。如果存在一个以上的 Text 节点,则返回第一个 Text 节点的值。否则返回 null
return 如果此节点是一个 Text 节点或该文本由此 Node 对象(该对象是一个 Text 对象)的第一个直接子节点(如果这种子节点存在)包含,则返回带有此节点文本的 String;否则返回 null
英文文档:

getValue

String getValue()
Returns the value of this node if this is a Text node or the value of the immediate child of this node otherwise. If there is an immediate child of this Node that it is a Text node then it's value will be returned. If there is more than one Text node then the value of the first Text Node will be returned. Otherwise null is returned.

Returns:
a String with the text of this node if this is a Text node or the text contained by the first immediate child of this Node object that is a Text object if such a child exists; null otherwise.

public void setValue(String value)
如果这是一个 Text 节点,则此方法会设置它的值,否则该方法设置此节点的直接 (Text) 子节点值。仅当存在子节点且该节点是 Text 节点时,才能设置此节点的直接子节点值,如果没有子节点,则将创建 Text 子节点。
ThrowsIllegalStateException: 如果该节点不是 Text 节点,也没有子节点或者有一个子节点但不是 Text 节点。
sinceSAAJ 1.2
英文文档:

setValue

void setValue(String value)
If this is a Text node then this method will set its value, otherwise it sets the value of the immediate (Text) child of this node. The value of the immediate child of this node can be set only if, there is one child node and that node is a Text node, or if there are no children in which case a child Text node will be created.

Throws:
IllegalStateException - if the node is not a Text node and either has more than one child node or has a child node that is not a Text node.
Since:
SAAJ 1.2

public void setParentElement(SOAPElement parent) throws SOAPException
将此 Node 对象的父节点设置为给定的 SOAPElement 对象。
parent 要设置为此 Node 对象父节点的 SOAPElement 对象
ThrowsSOAPException: 如果将父节点设置为给定元素时出现错误
See also getParentElement
英文文档:

setParentElement

void setParentElement(SOAPElement parent)
                      throws SOAPException
Sets the parent of this Node object to the given SOAPElement object.

Parameters:
parent - the SOAPElement object to be set as the parent of this Node object
Throws:
SOAPException - if there is a problem in setting the parent to the given element
See Also:
getParentElement()

public SOAPElement getParentElement()
返回此 Node 对象的父元素。如果树没有存入内存,则此方法抛出 UnsupportedOperationException
returnNode 对象的父节点 SOAPElement 对象;如果此 Node 对象为根节点,则返回 null
ThrowsUnsupportedOperationException: 如果整个树没有存入内存
See also setParentElement
英文文档:

getParentElement

SOAPElement getParentElement()
Returns the parent element of this Node object. This method can throw an UnsupportedOperationException if the tree is not kept in memory.

Returns:
the SOAPElement object that is the parent of this Node object or null if this Node object is root
Throws:
UnsupportedOperationException - if the whole tree is not kept in memory
See Also:
setParentElement(javax.xml.soap.SOAPElement)

public void detachNode()
从树中移除此 Node 对象。
英文文档:

detachNode

void detachNode()
Removes this Node object from the tree.


public void recycleNode()
通知实现此 Node 对象不再由应用程序使用,对于以后可能创建的节点,实现可以随意重用此对象。

调用 recycleNode 方法意味着以前调用过 detachNode 方法。

英文文档:

recycleNode

void recycleNode()
Notifies the implementation that this Node object is no longer being used by the application and that the implementation is free to reuse this object for nodes that may be created later.

Calling the method recycleNode implies that the method detachNode has been called previously.



Submit a bug or feature

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

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

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