Package net.sf.saxon.om
Interface NodeName
-
- All Known Implementing Classes:
CodedName
,FingerprintedQName
,NameOfNode
,NoNamespaceName
public interface NodeName
This interface represents a node name. Actually it represents any QName, but it is intended for use as an element or attribute name. Various implementations are available.An important requirement of an implementation of this interface is that the hashCode() and equals() methods are implemented correctly, so that any two node names compare equal if and only if the local name and namespace URI parts are equal under Unicode codepoint comparison. To ensure this, the hashCode must be computed using an algorithm equivalent to that used by the implementation class
FingerprintedQName
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
allocateNameCode(NamePool namePool)
Get the nameCode of this name, allocating a new code from the namepool if necessaryjava.lang.String
getDisplayName()
Get the display name, that is the lexical QName in the form [prefix:]local-partint
getFingerprint()
Get the fingerprint of this name if known.java.lang.String
getLocalPart()
Get the local part of the QNameint
getNameCode()
Get the nameCode of this name if known.NamespaceBinding
getNamespaceBinding()
Get aNamespaceBinding
whose (prefix, uri) pair are the prefix and URI of this node namejava.lang.String
getPrefix()
Get the prefix of the QName.StructuredQName
getStructuredQName()
Get the name in the form of a StructuredQNamejava.lang.String
getURI()
Get the namespace URI of the QName.boolean
hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprintboolean
isInNamespace(java.lang.String ns)
Test whether this name is in a given namespaceboolean
isInSameNamespace(NodeName other)
Test whether this name is in the same namespace as another name
-
-
-
Method Detail
-
getPrefix
java.lang.String getPrefix()
Get the prefix of the QName.- Returns:
- the prefix. Returns the empty string if the name is unprefixed.
-
getURI
java.lang.String getURI()
Get the namespace URI of the QName.- Returns:
- the URI. Returns the empty string to represent the no-namespace
-
getLocalPart
java.lang.String getLocalPart()
Get the local part of the QName- Returns:
- the local part of the QName
-
getDisplayName
java.lang.String getDisplayName()
Get the display name, that is the lexical QName in the form [prefix:]local-part- Returns:
- the lexical QName
-
getStructuredQName
StructuredQName getStructuredQName()
Get the name in the form of a StructuredQName- Returns:
- the name in the form of a StructuredQName
-
isInSameNamespace
boolean isInSameNamespace(NodeName other)
Test whether this name is in the same namespace as another name- Parameters:
other
- the other name- Returns:
- true if the two names are in the same namespace
-
isInNamespace
boolean isInNamespace(java.lang.String ns)
Test whether this name is in a given namespace- Parameters:
ns
- the namespace to be tested against- Returns:
- true if the name is in the specified namespace
-
getNamespaceBinding
NamespaceBinding getNamespaceBinding()
Get aNamespaceBinding
whose (prefix, uri) pair are the prefix and URI of this node name- Returns:
- the corresponding NamespaceBinding
-
hasFingerprint
boolean hasFingerprint()
Ask whether this node name representation has a known namecode and fingerprint- Returns:
- true if the methods getFingerprint() and getNameCode() will return a result other than -1
-
getFingerprint
int getFingerprint()
Get the fingerprint of this name if known. This method should not to any work to allocate a fingerprint if none is already available- Returns:
- the fingerprint if known; otherwise -1
-
getNameCode
int getNameCode()
Get the nameCode of this name if known. This method should not to any work to allocate a nameCode if none is already available- Returns:
- the nameCode if known; otherwise -1
-
allocateNameCode
int allocateNameCode(NamePool namePool)
Get the nameCode of this name, allocating a new code from the namepool if necessary- Parameters:
namePool
- the NamePool used to allocate the name- Returns:
- a nameCode for this name, newly allocated if necessary
-
-