public class StructuredQName extends Object
Instances of this class are immutable.
Constructor and Description |
---|
StructuredQName(String prefix,
String uri,
String localName)
Construct a StructuredQName from a prefix, URI, and local name.
|
Modifier and Type | Method and Description |
---|---|
static int |
computeHashCode(CharSequence uri,
CharSequence local)
Expose the hashCode algorithm so that other implementations of QNames can construct a compatible hashcode
|
boolean |
equals(Object other)
Compare two StructuredQName values for equality.
|
static StructuredQName |
fromClarkName(String expandedName)
Make a structuredQName from a Clark name
|
static StructuredQName |
fromEQName(CharSequence eqName)
Make a structured QName from a lexical QName, using a supplied NamespaceResolver to
resolve the prefix
|
static StructuredQName |
fromLexicalQName(CharSequence lexicalName,
boolean useDefault,
boolean allowEQName,
NameChecker checker,
NamespaceResolver resolver)
Make a structured QName from a lexical QName, using a supplied NamespaceResolver to
resolve the prefix
|
String |
getClarkName()
Get the expanded QName in Clark format, that is "{uri}local" if it is in a namespace, or just "local"
otherwise.
|
String |
getDisplayName()
Get the display name, that is the lexical QName in the form [prefix:]local-part
|
String |
getEQName()
Get the expanded QName as an EQName, that is "Q{uri}local" for a name in a namespace,
or "Q{}local" otherwise
|
int |
getFingerprint()
Get the fingerprint of this name if known.
|
String |
getLocalPart()
Get the local part of the QName
|
int |
getNameCode()
Get the nameCode of this name if known.
|
NamespaceBinding |
getNamespaceBinding()
Get the NamespaceBinding (prefix/uri pair) corresponding to this name
|
String |
getPrefix()
Get the prefix of the QName.
|
StructuredQName |
getStructuredQName()
Get the name as a StructuredQName (which it already is; but this satisfies the NodeName interface)
|
String |
getURI()
Get the namespace URI of the QName.
|
boolean |
hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprint
|
int |
hashCode()
Get a hashcode to reflect the equals() method
|
boolean |
isInNamespace(String ns)
Test whether this name is in a given namespace
|
boolean |
isInSameNamespace(NodeName other)
Test whether this name is in the same namespace as another name
|
QName |
toJaxpQName()
Convert the StructuredQName to a javax.xml.namespace.QName
|
String |
toString()
The toString() method displays the QName as a lexical QName, that is prefix:local
|
public StructuredQName(String prefix, String uri, String localName)
prefix
- The prefix. Use an empty string to represent the null prefix.uri
- The namespace URI. Use an empty string or null to represent the no-namespacelocalName
- The local part of the namepublic static StructuredQName fromClarkName(String expandedName)
expandedName
- the name in Clark notation "{uri}local" if in a namespace, or "local" otherwise.
The format "{}local" is also accepted for a name in no namespace. The EQName syntax (Q{uri}local) is
also accepted.IllegalArgumentException
- if the Clark name is malformedpublic static StructuredQName fromLexicalQName(CharSequence lexicalName, boolean useDefault, boolean allowEQName, NameChecker checker, NamespaceResolver resolver) throws XPathException
lexicalName
- the QName as a lexical name (prefix:local)useDefault
- set to true if an absent prefix implies use of the default namespace;
set to false if an absent prefix implies no namespaceallowEQName
- true if the EQName syntax Q{uri}local is acceptablechecker
- NameChecker to be used to check conformance against XML 1.0 or 1.1 lexical rulesresolver
- NamespaceResolver used to look up a URI for the prefixXPathException
- if the namespace prefix is not in scope or if the value is lexically
invalid. Error code FONS0004 is set if the namespace prefix has not been declared; error
code FOCA0002 is set if the name is lexically invalid.public static StructuredQName fromEQName(CharSequence eqName)
eqName
- the QName as an EQname (Q{uri}local), or an unqualified local name. The format is not checked.IllegalArgumentException
- if the eqName is obviously invalidpublic String getPrefix()
public String getURI()
public String getLocalPart()
public String getDisplayName()
public StructuredQName getStructuredQName()
public String getClarkName()
public String getEQName()
public String toString()
public boolean equals(Object other)
public int hashCode()
public static int computeHashCode(CharSequence uri, CharSequence local)
uri
- the namespace URIlocal
- the local namepublic boolean isInSameNamespace(NodeName other)
other
- the other namepublic boolean isInNamespace(String ns)
ns
- the namespace to be tested againstpublic QName toJaxpQName()
public NamespaceBinding getNamespaceBinding()
public boolean hasFingerprint()
public int getFingerprint()
public int getNameCode()
Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.