|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.xml.soap Interface SOAPElement
- All Known Subinterfaces:
- Detail, DetailEntry, SOAPBody, SOAPBodyElement, SOAPEnvelope, SOAPFault, SOAPFaultElement, SOAPHeader, SOAPHeaderElement
表示 SOAP 规范允许使用但未特别规定的 SOAP 消息元素的对象。此接口充当 SOAP 规范特别规定的那些对象的基本接口。
此接口中要求返回特定于 SAAJ 的对象的那些方法可以“安静地”替换树中的节点,以便按要求成功返回正确类型的对象。有关详细信息,请参见 #getChildElements()
和 HREF="package-summary.html#package_description">javax.xml.soap
。
An object representing an element of a SOAP message that is allowed but not specifically prescribed by a SOAP specification. This interface serves as the base interface for those objects that are specifically prescribed by a SOAP specification.
Methods in this interface that are required to return SAAJ specific objects
may "silently" replace nodes in the tree as required to successfully return
objects of the correct type. See getChildElements()
and
javax.xml.soap
for details.
Field Summary |
---|
Method Summary | |
---|---|
SOAPElement |
addAttribute(Name name,
String value)
Adds an attribute with the specified name and value to this SOAPElement object. |
SOAPElement |
addAttribute(QName qname,
String value)
Adds an attribute with the specified name and value to this SOAPElement object. |
SOAPElement |
addChildElement(Name name)
Creates a new SOAPElement object initialized with the
given Name object and adds the new element to this
SOAPElement object. |
SOAPElement |
addChildElement(QName qname)
Creates a new SOAPElement object initialized with the given
QName object and adds the new element to this SOAPElement
object. |
SOAPElement |
addChildElement(SOAPElement element)
Add a SOAPElement as a child of this
SOAPElement instance. |
SOAPElement |
addChildElement(String localName)
Creates a new SOAPElement object initialized with the
specified local name and adds the new element to this
SOAPElement object. |
SOAPElement |
addChildElement(String localName,
String prefix)
Creates a new SOAPElement object initialized with the
specified local name and prefix and adds the new element to this
SOAPElement object. |
SOAPElement |
addChildElement(String localName,
String prefix,
String uri)
Creates a new SOAPElement object initialized with the
specified local name, prefix, and URI and adds the new element to this
SOAPElement object. |
SOAPElement |
addNamespaceDeclaration(String prefix,
String uri)
Adds a namespace declaration with the specified prefix and URI to this SOAPElement object. |
SOAPElement |
addTextNode(String text)
Creates a new Text object initialized with the given
String and adds it to this SOAPElement object. |
QName |
createQName(String localName,
String prefix)
Creates a QName whose namespace URI is the one associated
with the parameter, prefix , in the context of this
SOAPElement . |
Iterator |
getAllAttributes()
Returns an Iterator over all of the attribute
Name objects in this
SOAPElement object. |
Iterator |
getAllAttributesAsQNames()
Returns an Iterator over all of the attributes
in this SOAPElement as QName objects. |
String |
getAttributeValue(Name name)
Returns the value of the attribute with the specified name. |
String |
getAttributeValue(QName qname)
Returns the value of the attribute with the specified qname. |
Iterator |
getChildElements()
Returns an Iterator over all the immediate child
Node s of this element. |
Iterator |
getChildElements(Name name)
Returns an Iterator over all the immediate child
Node s of this element with the specified name. |
Iterator |
getChildElements(QName qname)
Returns an Iterator over all the immediate child
Node s of this element with the specified qname. |
Name |
getElementName()
Returns the name of this SOAPElement object. |
QName |
getElementQName()
Returns the qname of this SOAPElement object. |
String |
getEncodingStyle()
Returns the encoding style for this SOAPElement object. |
Iterator |
getNamespacePrefixes()
Returns an Iterator over the namespace prefix
String s declared by this element. |
String |
getNamespaceURI(String prefix)
Returns the URI of the namespace that has the given prefix. |
Iterator |
getVisibleNamespacePrefixes()
Returns an Iterator over the namespace prefix
String s visible to this element. |
boolean |
removeAttribute(Name name)
Removes the attribute with the specified name. |
boolean |
removeAttribute(QName qname)
Removes the attribute with the specified qname. |
void |
removeContents()
Detaches all children of this SOAPElement . |
boolean |
removeNamespaceDeclaration(String prefix)
Removes the namespace declaration corresponding to the given prefix. |
SOAPElement |
setElementQName(QName newName)
Changes the name of this Element to newName if
possible. |
void |
setEncodingStyle(String encodingStyle)
Sets the encoding style for this SOAPElement object
to one specified. |
Methods inherited from interface javax.xml.soap.Node |
---|
detachNode, getParentElement, getValue, recycleNode, setParentElement, setValue |
Methods inherited from interface org.w3c.dom.Node |
---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
Methods inherited from interface org.w3c.dom.Element |
---|
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS |
Methods inherited from interface org.w3c.dom.Node |
---|
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
Method Detail |
---|
public SOAPElement
addChildElement(Name name) throws SOAPException
创建使用给定 Name
对象初始化的新 SOAPElement
对象,并将该新元素添加到此 SOAPElement
对象。
此方法在以后的 SAAJ 版本中可能会被废弃,并用 addChildElement(javax.xml.namespace.QName) 取代。
name |
Name 对象,带有新元素的 XML 名称 |
return |
创建的新 SOAPElement 对象 |
Throws | SOAPException:
如果在创建 SOAPElement 对象时发生错误 |
See also | addChildElement(javax.xml.namespace.QName) |
addChildElement
SOAPElement addChildElement(Name name) throws SOAPException
- Creates a new
SOAPElement
object initialized with the givenName
object and adds the new element to thisSOAPElement
object.This method may be deprecated in a future release of SAAJ in favor of addChildElement(javax.xml.namespace.QName)
- Parameters:
name
- aName
object with the XML name for the new element- Returns:
- the new
SOAPElement
object that was created - Throws:
SOAPException
- if there is an error in creating theSOAPElement
object- See Also:
addChildElement(javax.xml.namespace.QName)
public SOAPElement
addChildElement(javax.xml.namespace.QName qname) throws SOAPException
创建使用给定 QName
对象初始化的新 SOAPElement
对象,并将该新元素添加到此 SOAPElement
对象。新 SOAPElement
的 namespace、localname 和 prefix 都取自 qname
参数。
qname |
QName 对象,带有新元素的 XML 名称 |
return |
创建的新 SOAPElement 对象 |
Throws | SOAPException:
如果在创建 SOAPElement 对象时发生错误 |
since | SAAJ 1.3 |
See also | addChildElement(Name) |
addChildElement
SOAPElement addChildElement(QName qname) throws SOAPException
- Creates a new
SOAPElement
object initialized with the givenQName
object and adds the new element to thisSOAPElement
object. The namespace, localname and prefix of the newSOAPElement
are all taken from theqname
argument. - Parameters:
qname
- aQName
object with the XML name for the new element- Returns:
- the new
SOAPElement
object that was created - Throws:
SOAPException
- if there is an error in creating theSOAPElement
object- Since:
- SAAJ 1.3
- See Also:
addChildElement(Name)
public SOAPElement
addChildElement(String localName) throws SOAPException
创建使用指定本地名称初始化的新 SOAPElement
对象,并将该新元素添加到此 SOAPElement
对象。新的 SOAPElement
继承任何作用域内的默认名称空间。
localName |
给出元素本地名称的 String |
return |
创建的新 SOAPElement 对象 |
Throws | SOAPException:
如果在创建 SOAPElement 对象时发生错误 |
addChildElement
SOAPElement addChildElement(String localName) throws SOAPException
- Creates a new
SOAPElement
object initialized with the specified local name and adds the new element to thisSOAPElement
object. The newSOAPElement
inherits any in-scope default namespace. - Parameters:
localName
- aString
giving the local name for the element- Returns:
- the new
SOAPElement
object that was created - Throws:
SOAPException
- if there is an error in creating theSOAPElement
object
public SOAPElement
addChildElement(String localName, String prefix) throws SOAPException
创建使用指定本地名称和前缀初始化的新 SOAPElement
对象,并将该新元素添加到此 SOAPElement
对象。
localName |
给出新元素本地名称的 String |
prefix |
给出新元素名称空间前缀的 String |
return |
创建的新 SOAPElement 对象 |
Throws | SOAPException:
如果 prefix 在此 SOAPElement 上下文中无效,或者在创建 SOAPElement 对象时发生错误 |
addChildElement
SOAPElement addChildElement(String localName, String prefix) throws SOAPException
- Creates a new
SOAPElement
object initialized with the specified local name and prefix and adds the new element to thisSOAPElement
object. - Parameters:
localName
- aString
giving the local name for the new elementprefix
- aString
giving the namespace prefix for the new element- Returns:
- the new
SOAPElement
object that was created - Throws:
SOAPException
- if theprefix
is not valid in the context of thisSOAPElement
or if there is an error in creating theSOAPElement
object
public SOAPElement
addChildElement(String localName, String prefix, String uri) throws SOAPException
创建使用指定本地名称、前缀和 URI 初始化的新 SOAPElement
对象,并将该新元素添加到此 SOAPElement
对象。
localName |
给出新元素本地名称的 String |
prefix |
给出新元素名称空间前缀的 String |
uri |
给出新元素所属空间名称 URI 的 String |
return |
创建的新 SOAPElement 对象 |
Throws | SOAPException:
如果在创建 SOAPElement 对象时发生错误 |
addChildElement
SOAPElement addChildElement(String localName, String prefix, String uri) throws SOAPException
- Creates a new
SOAPElement
object initialized with the specified local name, prefix, and URI and adds the new element to thisSOAPElement
object. - Parameters:
localName
- aString
giving the local name for the new elementprefix
- aString
giving the namespace prefix for the new elementuri
- aString
giving the URI of the namespace to which the new element belongs- Returns:
- the new
SOAPElement
object that was created - Throws:
SOAPException
- if there is an error in creating theSOAPElement
object
public SOAPElement
addChildElement(SOAPElement element) throws SOAPException
将 SOAPElement
作为此 SOAPElement
实例的子级添加。应该由 SOAPFactory
来创建 SOAPElement
。调用者不应依靠此方式添加到 XML 树的元素实例。实现最后可以将传递的 SOAPElement
的内容复制到一个不同 SOAPElement
实现的实例中。例如,如果对 SOAPHeader
调用 addChildElement()
,则 element
将被复制到 SOAPHeaderElement
的实例中。
以 element
为根的片段将作为一个整体添加,如果发生错误,则不添加。
以 element
为根的片段不能包含名为 "Envelope"、"Header" 或 "Body" 且属于 SOAP 名称空间的元素。片段中出现的任何名称空间前缀都应该使用片段本身中适当的名称空间声明来完整解析。
element |
要作为新子级添加的 SOAPElement |
Throws | SOAPException: 如果在作为子级添加此元素时出现错误 |
return | 一个实例,表示实际添加到树的新 SOAP 元素。 |
addChildElement
SOAPElement addChildElement(SOAPElement element) throws SOAPException
- Add a
SOAPElement
as a child of thisSOAPElement
instance. TheSOAPElement
is expected to be created by aSOAPFactory
. Callers should not rely on the element instance being added as is into the XML tree. Implementations could end up copying the content of theSOAPElement
passed into an instance of a differentSOAPElement
implementation. For instance ifaddChildElement()
is called on aSOAPHeader
,element
will be copied into an instance of aSOAPHeaderElement
.The fragment rooted in
element
is either added as a whole or not at all, if there was an error.The fragment rooted in
element
cannot contain elements named "Envelope", "Header" or "Body" and in the SOAP namespace. Any namespace prefixes present in the fragment should be fully resolved using appropriate namespace declarations within the fragment itself. - Parameters:
element
- theSOAPElement
to be added as a new child- Returns:
- an instance representing the new SOAP element that was actually added to the tree.
- Throws:
SOAPException
- if there was an error in adding this element as a child
public void
removeContents()
分离此 SOAPElement
的所有子级。
此方法对回滚部分完成的 SOAPHeaders
和 SOAPBodys
的构造很有用,便于准备在检测到错误条件时发送错误。它对于回收 SOAP 消息中的文档各部分也很有用。
since | SAAJ 1.2 |
removeContents
void removeContents()
- Detaches all children of this
SOAPElement
.This method is useful for rolling back the construction of partially completed
SOAPHeaders
andSOAPBodys
in preparation for sending a fault when an error condition is detected. It is also useful for recycling portions of a document within a SOAP message. - Since:
- SAAJ 1.2
public SOAPElement
addTextNode(String text) throws SOAPException
创建使用给定 String
初始化的新 Text
对象,并将其添加到此 SOAPElement
对象。
text |
带有要添加文本内容的 String 对象 |
return |
将插入新 Text 对象的 SOAPElement 对象 |
Throws | SOAPException:
如果在创建新 Text 时发生错误,或者将它作为子级附加到此 SOAPElement 不合法 |
addTextNode
SOAPElement addTextNode(String text) throws SOAPException
- Creates a new
Text
object initialized with the givenString
and adds it to thisSOAPElement
object. - Parameters:
text
- aString
object with the textual content to be added- Returns:
- the
SOAPElement
object into which the newText
object was inserted - Throws:
SOAPException
- if there is an error in creating the newText
object or if it is not legal to attach it as a child to thisSOAPElement
public SOAPElement
addAttribute(Name name, String value) throws SOAPException
将带有指定名称和值的属性添加到此 SOAPElement
对象。
name |
带有属性名称的 Name 对象 |
value |
给出属性值的 String |
return |
将插入属性的 SOAPElement 对象
|
Throws | SOAPException:
如果在创建属性时发生错误,或者在此 SOAPElement 上设置带有 Name name 的属性无效。 |
See also | addAttribute(javax.xml.namespace.QName, String) |
addAttribute
SOAPElement addAttribute(Name name, String value) throws SOAPException
- Adds an attribute with the specified name and value to this
SOAPElement
object. - Parameters:
name
- aName
object with the name of the attributevalue
- aString
giving the value of the attribute- Returns:
- the
SOAPElement
object into which the attribute was inserted - Throws:
SOAPException
- if there is an error in creating the Attribute, or it is invalid to set an attribute withName
name
on this SOAPElement.- See Also:
addAttribute(javax.xml.namespace.QName, String)
public SOAPElement
addAttribute(javax.xml.namespace.QName qname, String value) throws SOAPException
将带有指定名称和值的属性添加到此 SOAPElement
对象。
qname |
带有属性名称的 QName 对象 |
value |
给出属性值的 String |
return |
将插入属性的 SOAPElement 对象
|
Throws | SOAPException:
如果在创建属性时出现错误,如果在此 SOAPElement 上设置带有 QName qname 的属性无效。 |
since | SAAJ 1.3 |
See also | addAttribute(Name, String) |
addAttribute
SOAPElement addAttribute(QName qname, String value) throws SOAPException
- Adds an attribute with the specified name and value to this
SOAPElement
object. - Parameters:
qname
- aQName
object with the name of the attributevalue
- aString
giving the value of the attribute- Returns:
- the
SOAPElement
object into which the attribute was inserted - Throws:
SOAPException
- if there is an error in creating the Attribute, or it is invalid to set an attribute withQName
qname
on this SOAPElement.- Since:
- SAAJ 1.3
- See Also:
addAttribute(Name, String)
public SOAPElement
addNamespaceDeclaration(String prefix, String uri) throws SOAPException
将带有指定前缀和 URI 的名称空间声明添加到此 SOAPElement
对象。
prefix |
给出名称空间前缀的 String |
uri |
给出名称空间 URI 的 String |
return |
将插入名称空间声明的 SOAPElement 对象。
|
Throws | SOAPException: 如果在创建名称空间时发生错误 |
addNamespaceDeclaration
SOAPElement addNamespaceDeclaration(String prefix, String uri) throws SOAPException
- Adds a namespace declaration with the specified prefix and URI to this
SOAPElement
object. - Parameters:
prefix
- aString
giving the prefix of the namespaceuri
- aString
giving the uri of the namespace- Returns:
- the
SOAPElement
object into which this namespace declaration was inserted. - Throws:
SOAPException
- if there is an error in creating the namespace
public String
getAttributeValue(Name name)
返回带有指定名称的属性值。
name |
带有属性名称的 Name 对象 |
return |
给出指定属性值的 String ,如果没有这种属性,则返回 Null |
See also | getAttributeValue(javax.xml.namespace.QName) |
getAttributeValue
String getAttributeValue(Name name)
- Returns the value of the attribute with the specified name.
- Parameters:
name
- aName
object with the name of the attribute- Returns:
- a
String
giving the value of the specified attribute, Null if there is no such attribute - See Also:
getAttributeValue(javax.xml.namespace.QName)
public String
getAttributeValue(javax.xml.namespace.QName qname)
返回带有指定 qname 的属性值。
qname |
带有属性 qname 的 QName 对象 |
return |
给出指定属性值的 String ,如果没有这种属性,则返回 Null |
since | SAAJ 1.3 |
See also | getAttributeValue(Name) |
getAttributeValue
String getAttributeValue(QName qname)
- Returns the value of the attribute with the specified qname.
- Parameters:
qname
- aQName
object with the qname of the attribute- Returns:
- a
String
giving the value of the specified attribute, Null if there is no such attribute - Since:
- SAAJ 1.3
- See Also:
getAttributeValue(Name)
public java.util.Iterator<E>
getAllAttributes()
返回可在此 SOAPElement
对象中所有属性 Name
对象上进行迭代的 Iterator
。迭代器可以用于获取属性名称,然后可将这些名称传递给方法 getAttributeValue
以检索每个属性的值。
return | 在属性名称上进行迭代的迭代器 |
See also | getAllAttributesAsQNames() |
getAllAttributes
Iterator getAllAttributes()
- Returns an
Iterator
over all of the attributeName
objects in thisSOAPElement
object. The iterator can be used to get the attribute names, which can then be passed to the methodgetAttributeValue
to retrieve the value of each attribute. - Returns:
- an iterator over the names of the attributes
- See Also:
getAllAttributesAsQNames()
public java.util.Iterator<E>
getAllAttributesAsQNames()
返回可在此 SOAPElement
对象(以 QName
对象的形式)中的所有属性上进行迭代的 Iterator
。迭代器可以用于获取属性 QName,然后可将这些名称传递给方法 getAttributeValue
以检索每个属性的值。
return | 在属性的 QNames 上进行迭代的迭代器 |
since | SAAJ 1.3 |
See also | getAllAttributes() |
getAllAttributesAsQNames
Iterator getAllAttributesAsQNames()
- Returns an
Iterator
over all of the attributes in thisSOAPElement
asQName
objects. The iterator can be used to get the attribute QName, which can then be passed to the methodgetAttributeValue
to retrieve the value of each attribute. - Returns:
- an iterator over the QNames of the attributes
- Since:
- SAAJ 1.3
- See Also:
getAllAttributes()
public String
getNamespaceURI(String prefix)
返回带有给定前缀的名称空间的 URI。
prefix |
一个 String ,给出用来搜索的名称空间前缀 |
return |
一个 String ,带有给定前缀名称空间的 URI
|
getNamespaceURI
String getNamespaceURI(String prefix)
- Returns the URI of the namespace that has the given prefix.
- Parameters:
prefix
- aString
giving the prefix of the namespace for which to search- Returns:
- a
String
with the uri of the namespace that has the given prefix
public java.util.Iterator<E>
getNamespacePrefixes()
返回可在此元素声明的名称空间前缀 String
上进行迭代的 Iterator
。由此迭代器返回的前缀可以传递给方法 getNamespaceURI
,以检索每个名称空间的 URI。
return |
在此 SOAPElement 对象的名称空间前缀上进行迭代的迭代器
|
getNamespacePrefixes
Iterator getNamespacePrefixes()
- Returns an
Iterator
over the namespace prefixString
s declared by this element. The prefixes returned by this iterator can be passed to the methodgetNamespaceURI
to retrieve the URI of each namespace. - Returns:
- an iterator over the namespace prefixes in this
SOAPElement
object
public java.util.Iterator<E>
getVisibleNamespacePrefixes()
返回在此元素可见的名称空间前缀 String
上进行迭代的 Iterator
。由此迭代器返回的前缀可以传递给方法 getNamespaceURI
,以检索每个名称空间的 URI。
return |
在此 SOAPElement 对象作用域内的名称空间前缀上进行迭代的迭代器
|
since | SAAJ 1.2 |
getVisibleNamespacePrefixes
Iterator getVisibleNamespacePrefixes()
- Returns an
Iterator
over the namespace prefixString
s visible to this element. The prefixes returned by this iterator can be passed to the methodgetNamespaceURI
to retrieve the URI of each namespace. - Returns:
- an iterator over the namespace prefixes are within scope of this
SOAPElement
object - Since:
- SAAJ 1.2
public javax.xml.namespace.QName
createQName(String localName, String prefix) throws SOAPException
创建一个 QName
,其名称空间 URI 应与此 SOAPElement
上下文中的参数、prefix
相关联。新 QName
的其余元素都直接取自参数、localName
和 prefix
。
localName |
包含名称本地部分的 String 。 |
prefix |
包含名称前缀的 String 。 |
return |
一个 QName ,带有指定的 localName 和 prefix ,以及与此 SOAPElement 上下文中的 prefix 关联的名称空间。如果将 prefix 作为参数提供给
#getNamespaceURI(String) ,则此名称空间将与该方法返回的名称空间相同。
|
Throws | SOAPException:
如果无法创建 QName 。 |
since | SAAJ 1.3 |
createQName
QName createQName(String localName, String prefix) throws SOAPException
- Creates a
QName
whose namespace URI is the one associated with the parameter,prefix
, in the context of thisSOAPElement
. The remaining elements of the newQName
are taken directly from the parameters,localName
andprefix
. - Parameters:
localName
- aString
containing the local part of the name.prefix
- aString
containing the prefix for the name.- Returns:
- a
QName
with the specifiedlocalName
andprefix
, and with a namespace that is associated with theprefix
in the context of thisSOAPElement
. This namespace will be the same as the one that would be returned bygetNamespaceURI(String)
if it were givenprefix
as it's parameter. - Throws:
SOAPException
- if theQName
cannot be created.- Since:
- SAAJ 1.3
public Name
getElementName()
返回此 SOAPElement
对象的名称。
return |
具有此 SOAPElement 对象名称的 Name 对象
|
getElementName
Name getElementName()
- Returns the name of this
SOAPElement
object. - Returns:
- a
Name
object with the name of thisSOAPElement
object
public javax.xml.namespace.QName
getElementQName()
返回此 SOAPElement
对象的 qname。
return |
具有此 SOAPElement 对象 qname 的 QName 对象 |
since | SAAJ 1.3 |
See also | getElementName() |
getElementQName
QName getElementQName()
- Returns the qname of this
SOAPElement
object. - Returns:
- a
QName
object with the qname of thisSOAPElement
object - Since:
- SAAJ 1.3
- See Also:
getElementName()
public SOAPElement
setElementQName(javax.xml.namespace.QName newName) throws SOAPException
如果可能,将此 Element
的名称更改为 newName
。SOAP 定义的元素,如 SOAPEnvelope、SOAPHeader、SOAPBody 等,都无法使用此方法更改它们的名称。任何此类尝试都会导致抛出 SOAPException。
调用者不应依靠按此方式重命名的元素实例。实现最后可以将 SOAPElement
的内容复制到重命名实例。
newName |
Element 的新名称。 |
Throws | SOAPException:
如果不允许更改此 Element 的名称。 |
return | 重命名的节点 |
since | SAAJ 1.3 |
setElementQName
SOAPElement setElementQName(QName newName) throws SOAPException
- Changes the name of this
Element
tonewName
if possible. SOAP Defined elements such as SOAPEnvelope, SOAPHeader, SOAPBody etc. cannot have their names changed using this method. Any attempt to do so will result in a SOAPException being thrown.Callers should not rely on the element instance being renamed as is. Implementations could end up copying the content of the
SOAPElement
to a renamed instance. - Parameters:
newName
- the new name for theElement
.- Returns:
- The renamed Node
- Throws:
SOAPException
- if changing the name of thisElement
is not allowed.- Since:
- SAAJ 1.3
public boolean
removeAttribute(Name name)
移除带有指定名称的属性。
name |
Name 对象,带有要移除属性的名称 |
return |
如果成功移除了属性,则返回 true ;否则返回 false |
See also | removeAttribute(javax.xml.namespace.QName) |
removeAttribute
boolean removeAttribute(Name name)
- Removes the attribute with the specified name.
- Parameters:
name
- theName
object with the name of the attribute to be removed- Returns:
true
if the attribute was removed successfully;false
if it was not- See Also:
removeAttribute(javax.xml.namespace.QName)
public boolean
removeAttribute(javax.xml.namespace.QName qname)
移除带有指定 qname 的属性。
qname |
QName 对象,带有要移除属性的 qname |
return |
如果成功移除了属性,则返回 true ;否则返回 false |
since | SAAJ 1.3 |
See also | removeAttribute(Name) |
removeAttribute
boolean removeAttribute(QName qname)
- Removes the attribute with the specified qname.
- Parameters:
qname
- theQName
object with the qname of the attribute to be removed- Returns:
true
if the attribute was removed successfully;false
if it was not- Since:
- SAAJ 1.3
- See Also:
removeAttribute(Name)
public boolean
removeNamespaceDeclaration(String prefix)
移除对应于给定前缀的名称空间声明。
prefix |
一个 String ,给出用来搜索的前缀 |
return |
如果成功移除了名称空间声明,则返回 true ;否则返回 false
|
removeNamespaceDeclaration
boolean removeNamespaceDeclaration(String prefix)
- Removes the namespace declaration corresponding to the given prefix.
- Parameters:
prefix
- aString
giving the prefix for which to search- Returns:
true
if the namespace declaration was removed successfully;false
if it was not
public java.util.Iterator<E>
getChildElements()
返回可在此元素的所有直接子 Node
上进行迭代的 Iterator
。这包括 javax.xml.soap.Text
对象以及 SOAPElement
对象。
调用此方法可能导致子 Element
、SOAPElement
和 org.w3c.dom.Text
节点被适合于此父节点类型的 SOAPElement
、SOAPHeaderElement
、SOAPBodyElement
或 javax.xml.soap.Text
节点替换。因此,调用的应用程序必须将任何现有的对通过 DOM API 获取的那些子节点的引用视为无效,并将其丢弃或用此 Iterator
返回的值进行更新。可以通过调用等效的 DOM API 来避免此行为。有关更多信息,请参阅 HREF="package-summary.html#package_description">javax.xml.soap
。
return |
带有此 SOAPElement 对象内容的迭代器
|
getChildElements
Iterator getChildElements()
- Returns an
Iterator
over all the immediate childNode
s of this element. This includesjavax.xml.soap.Text
objects as well asSOAPElement
objects.Calling this method may cause child
Element
,SOAPElement
andorg.w3c.dom.Text
nodes to be replaced bySOAPElement
,SOAPHeaderElement
,SOAPBodyElement
orjavax.xml.soap.Text
nodes as appropriate for the type of this parent node. As a result the calling application must treat any existing references to these child nodes that have been obtained through DOM APIs as invalid and either discard them or refresh them with the values returned by thisIterator
. This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. - Returns:
- an iterator with the content of this
SOAPElement
object
public java.util.Iterator<E>
getChildElements(Name name)
返回可在带有指定名称的此元素所有直接子 Node
上进行迭代的 Iterator
。所有这些子节点都将是 SOAPElement
节点。
调用此方法可能导致子 Element
、SOAPElement
和 org.w3c.dom.Text
节点被适合于此父节点类型的 SOAPElement
、SOAPHeaderElement
、SOAPBodyElement
或 javax.xml.soap.Text
节点替换。因此,调用的应用程序必须将任何现有的对通过 DOM API 获取的那些子节点的引用视为无效,并将其丢弃或用此 Iterator
返回的值进行更新。可以通过调用等效的 DOM API 来避免此行为。有关更多信息,请参阅 HREF="package-summary.html#package_description">javax.xml.soap
。
name |
Name 对象,带有要返回的子元素的名称 |
return |
在带有指定名称的此 SOAPElement 对象的所有元素上进行迭代的 Iterator 对象 |
See also | getChildElements(javax.xml.namespace.QName) |
getChildElements
Iterator getChildElements(Name name)
- Returns an
Iterator
over all the immediate childNode
s of this element with the specified name. All of these children will beSOAPElement
nodes.Calling this method may cause child
Element
,SOAPElement
andorg.w3c.dom.Text
nodes to be replaced bySOAPElement
,SOAPHeaderElement
,SOAPBodyElement
orjavax.xml.soap.Text
nodes as appropriate for the type of this parent node. As a result the calling application must treat any existing references to these child nodes that have been obtained through DOM APIs as invalid and either discard them or refresh them with the values returned by thisIterator
. This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. - Parameters:
name
- aName
object with the name of the child elements to be returned- Returns:
- an
Iterator
object over all the elements in thisSOAPElement
object with the specified name - See Also:
getChildElements(javax.xml.namespace.QName)
public java.util.Iterator<E>
getChildElements(javax.xml.namespace.QName qname)
返回可在带有指定 qname 的此元素所有直接子 Node
上进行迭代的 Iterator
。所有这些子节点都将是 SOAPElement
节点。
调用此方法可能导致子 Element
、SOAPElement
和 org.w3c.dom.Text
节点被适合于此父节点类型的 SOAPElement
、SOAPHeaderElement
、SOAPBodyElement
或 javax.xml.soap.Text
节点替换。因此,调用的应用程序必须将任何现有的对通过 DOM API 获取的那些子节点的引用视为无效,并将其丢弃或用此 Iterator
返回的值进行更新。可以通过调用等效的 DOM API 来避免此行为。有关更多信息,请参阅 HREF="package-summary.html#package_description">javax.xml.soap
。
qname |
QName 对象,带有要返回的子元素的 qname |
return |
在带有指定 qname 的此 SOAPElement 对象的所有元素上进行迭代的 Iterator 对象 |
since | SAAJ 1.3 |
See also | getChildElements(Name) |
getChildElements
Iterator getChildElements(QName qname)
- Returns an
Iterator
over all the immediate childNode
s of this element with the specified qname. All of these children will beSOAPElement
nodes.Calling this method may cause child
Element
,SOAPElement
andorg.w3c.dom.Text
nodes to be replaced bySOAPElement
,SOAPHeaderElement
,SOAPBodyElement
orjavax.xml.soap.Text
nodes as appropriate for the type of this parent node. As a result the calling application must treat any existing references to these child nodes that have been obtained through DOM APIs as invalid and either discard them or refresh them with the values returned by thisIterator
. This behavior can be avoided by calling the equivalent DOM APIs. See javax.xml.soap for more details. - Parameters:
qname
- aQName
object with the qname of the child elements to be returned- Returns:
- an
Iterator
object over all the elements in thisSOAPElement
object with the specified qname - Since:
- SAAJ 1.3
- See Also:
getChildElements(Name)
public void
setEncodingStyle(String encodingStyle) throws SOAPException
将此 SOAPElement
对象的编码样式设置为指定样式。
encodingStyle |
给出编码样式的 String |
Throws | IllegalArgumentException: 如果在设置编码样式时出现问题。 |
Throws | SOAPException: 如果为此 SOAPElement 设置的编码样式无效。 |
See also | getEncodingStyle |
setEncodingStyle
void setEncodingStyle(String encodingStyle) throws SOAPException
- Sets the encoding style for this
SOAPElement
object to one specified. - Parameters:
encodingStyle
- aString
giving the encoding style- Throws:
IllegalArgumentException
- if there was a problem in the encoding style being set.SOAPException
- if setting the encodingStyle is invalid for this SOAPElement.- See Also:
getEncodingStyle()
public String
getEncodingStyle()
返回此 SOAPElement
对象的编码样式。
return |
给出编码样式的 String |
See also | setEncodingStyle |
getEncodingStyle
String getEncodingStyle()
- Returns the encoding style for this
SOAPElement
object. - Returns:
- a
String
giving the encoding style - See Also:
setEncodingStyle(java.lang.String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Submit a bug or feature
Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.
PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!