|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
javax.xml.soap Interface Name
public interface Name
XML 名称的表示形式。此接口提供的方法可获取本地和限定于命名空间的名称,以及与名称的命名空间关联的前缀。它还能够获取命名空间的 URI。
以下是一个元素中命名空间声明的示例。
<wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">("xmlns" 代表 "XML namespace"。)下文显示了
Name
接口中的方法将返回的内容。
getQualifiedName
将返回 "prefix:LocalName" = "WOMBAT:GetLastTradePrice"getURI
将返回 "http://www.wombat.org/trader"getLocalName
将返回 "GetLastTracePrice"getPrefix
将返回 "WOMBAT"
XML 命名空间用于辨别 SOAP 标识符与特定于应用程序的标识符。
Name
对象是使用方法 SOAPEnvelope.createName
创建的,该方法有两种形式。一种方法创建带有本地名称、命名空间前缀和命名空间 URI 的 Name
对象,另一种方法创建只带有本地名称的 Name
对象。以下代码行(其中 se 是一个 SOAPEnvelope
对象)创建带有所有三个元素的新 Name
对象。
Name name = se.createName("GetLastTradePrice", "WOMBAT", "http://www.wombat.org/trader");以下代码行给出一个如何使用对象
Name
的示例。变量 element 是一个 SOAPElement
对象。此代码创建带有给定名称的新 SOAPElement
对象并将其添加到 element。
element.addChildElement(name);
Name
接口在将来的 SAAJ 版本中可能会被废弃,并被 javax.xml.namespace.QName
取代。
See also SOAPEnvelope.createName, SOAPFactory.createName
英文文档:
A representation of an XML name. This interface provides methods for getting the local and namespace-qualified names and also for getting the prefix associated with the namespace for the name. It is also possible to get the URI of the namespace.
The following is an example of a namespace declaration in an element.
<wombat:GetLastTradePrice xmlns:wombat="http://www.wombat.org/trader">("xmlns" stands for "XML namespace".) The following shows what the methods in the
Name
interface will return.
getQualifiedName
will return "prefix:LocalName" = "WOMBAT:GetLastTradePrice"getURI
will return "http://www.wombat.org/trader"getLocalName
will return "GetLastTracePrice"getPrefix
will return "WOMBAT"
XML namespaces are used to disambiguate SOAP identifiers from application-specific identifiers.
Name
objects are created using the method
SOAPEnvelope.createName
, which has two versions.
One method creates Name
objects with
a local name, a namespace prefix, and a namespace URI.
and the second creates Name
objects with just a local name.
The following line of
code, in which se is a SOAPEnvelope
object, creates a new
Name
object with all three.
Name name = se.createName("GetLastTradePrice", "WOMBAT", "http://www.wombat.org/trader");The following line of code gives an example of how a
Name
object
can be used. The variable element is a SOAPElement
object.
This code creates a new SOAPElement
object with the given name and
adds it to element.
element.addChildElement(name);
The Name
interface may be deprecated in a future release of SAAJ
in favor of javax.xml.namespace.QName
Method Summary | |
---|---|
String |
getLocalName()
Gets the local name part of the XML name that this Name
object represents. |
String |
getPrefix()
Returns the prefix that was specified when this Name object
was initialized. |
String |
getQualifiedName()
Gets the namespace-qualified name of the XML name that this Name object represents. |
String |
getURI()
Returns the URI of the namespace for the XML name that this Name object represents. |
Method Detail |
---|
public String
getLocalName()
获取此 Name
对象表示的 XML 名称的本地名称部分。
return | 给出本地名称的字符串 |
getLocalName
String getLocalName()
- Gets the local name part of the XML name that this
Name
object represents. - Returns:
- a string giving the local name
public String
getQualifiedName()
获取此 Name
对象表示的 XML 名称限定于命名空间的名称。
return | 字符串形式的限定于命名空间的名称。 |
getQualifiedName
String getQualifiedName()
- Gets the namespace-qualified name of the XML name that this
Name
object represents. - Returns:
- the namespace-qualified name as a string
public String
getPrefix()
返回初始化此 Name
对象时指定的前缀。此前缀与此 Name
对象表示的 XML 名称的命名空间关联。
return | 字符串形式的数据 |
getPrefix
String getPrefix()
- Returns the prefix that was specified when this
Name
object was initialized. This prefix is associated with the namespace for the XML name that thisName
object represents. - Returns:
- the prefix as a string
public String
getURI()
返回此 Name
对象表示的 XML 名称命名空间的 URI。
return | 字符串形式的 URI |
getURI
String getURI()
- Returns the URI of the namespace for the XML
name that this
Name
object represents. - Returns:
- the URI as a 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 : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!