|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--javax.xml.namespace.QName
XML namespaces provide a way to distinguish determiniscally between XML elements that have the same local name but are, in fact, from different vocabularies. This is done by associating an element with a namespace. A namespace acts as a scope for all elements associated with it. Namespaces themselves also have names. A namespace name is a uniform resource identifier (URI). Such a URI serves as a unique string, and needs not be able to be dereferenced. The namespace name and the local name of the element together form a globally unique name known as a qualified name.
Namespace declarations appear inside an element start tag and
are used to map a namespace name to another, typically shorter,
string known as a namespace prefix. The syntax for a
namespace declaration is xmlns:prefix='URI'. It is
also possible to map a namespace name to no prefix using a default
namespace declaration. The syntax for a default namespace
declaration is xmlns='URI'. Only one default namespace
declaration may appear on an element. Any number of nondefault
namespace declarations may appear on an element, provided they
all have different prefix parts.
The names of all elements in a document that conforms to the
Namespaces in the XML specification are QName. Syntactically,
all QNames have a local name and an optional prefix.
Both the local name and the prefix are NCNames. An
NCName is a name without a colon in it.
Elements not in any namespace are known as unqualified elements.
| Constructor Summary | ||
QName(String localName)
Constructs a QName object given the local name. |
||
QName(String namespaceURI,
String localName)
Constructs a QName object given the Namespace URI,
and the local name. |
||
QName(String namespaceURI,
String localName,
String prefix)
Constructs a QName object given the Namespace URI,
the local name, and the prefix. |
||
| Method Summary | ||
boolean |
equals(Object anObject)
Equality testing for QNames. |
|
String |
getLocalPart()
Retrieves the local name of this QName. |
|
String |
getNamespaceURI()
Retrieves the Namespace URI of this QName. |
|
String |
getPrefix()
Retrieves the prefix of this QName. |
|
int |
hashCode()
Generates the hash code for this QName. |
|
String |
toString()
Returns a String representation of this
QName. |
|
static QName |
valueOf(String aString)
Given the string representation of a QName, constructs
the QName with the prefix being set to the empty string. |
|
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public QName(String localName)
QName object given the local name.
The namespace URI is set to the empty string "" (for unqualified
elements); the prefix is set to the empty string "" (for default
namespace).localName - the local name of this QName.public QName(String namespaceURI, String localName)
Constructs a QName object given the Namespace URI,
and the local name.
The prefix is set to the empty string "" (for default namespace).
namespaceURI - the namespace URI of this QName.localName - the local name of this QName.public QName(String namespaceURI, String localName, String prefix)
Constructs a QName object given the Namespace URI,
the local name, and the prefix.
If the Namespace URI is null, it is set to "".
(The namespace name of unqualified elements is the empty string "".
If a default namespace declaration is in scope and an unqualified
element is required, the default namespace declaration can be
masked by providing a namespace declaration of the form
xmlns="" on the element.)
Note: Use "" to indicate that a prefix is either not present or not relevant.
namespaceURI - the namespace URI of this QName.localName - the local name of this QName.prefix - the prefix of this QName.- Throws:
IllegalArgumentException - if the local name is null
or it is of length 0; or if the prefix
is null.- Since:
- JDE 4.3.0
| Method Detail |
public boolean equals(Object anObject)
Equality testing for QNames.
Two QNames are defined to be equal to each
other iff their Namespace URIs and their local names are
the same.
Note: Their prefixes might be different.
anObject - the Object for equality testing.true if anObject is equal
to this QName; false otherwise.public String getLocalPart()
Retrieves the local name of this QName.
QName.public String getNamespaceURI()
Retrieves the Namespace URI of this QName.
QName.public String getPrefix()
Retrieves the prefix of this QName.
QName.public static QName valueOf(String aString)
Given the string representation of a QName, constructs
the QName with the prefix being set to the empty string.
Note:This operation is the inverse of QName.toString.
aString - the string representation of a QName.QName constructed from aStringIllegalArgumentException - if aString is not of the
form returned by QName.toString.toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.