Package net.sf.saxon.om
Class NameOfNode
java.lang.Object
net.sf.saxon.om.NameOfNode
- All Implemented Interfaces:
IdentityComparable
,NodeName
An implementation of NodeName that gets the name of an existing NodeInfo object.
Useful when nodes are copied. However, it's not safe to use when the node is mutable.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether some other object is "equal to" this one.Get the display name, that is the lexical QName in the form [prefix:]local-partint
Get the fingerprint of this name if known.Get the local part of the QNameGet aNamespaceBinding
whose (prefix, uri) pair are the prefix and URI of this node nameGet the namespace URI of the QName.Get the prefix of the QName.Get the name in the form of a StructuredQNameboolean
Ask whether this node name representation has a known namecode and fingerprintint
hashCode()
Returns a hash code value for the object.boolean
hasURI
(NamespaceUri ns) Test whether this name is in a given namespaceint
Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()boolean
isIdentical
(IdentityComparable other) Determine whether two IdentityComparable objects are identical.static NodeName
Make a NodeName object based on the name of a supplied node.int
obtainFingerprint
(NamePool namePool) Get the nameCode of this name, allocating a new code from the namepool if necessary
-
Method Details
-
makeName
Make a NodeName object based on the name of a supplied node.- Parameters:
node
- the supplied node- Returns:
- a NameOfNode object unless the node is mutable, in which case an immutable name is returned.
-
getPrefix
Get the prefix of the QName. -
getNamespaceUri
Get the namespace URI of the QName.- Specified by:
getNamespaceUri
in interfaceNodeName
- Returns:
- the URI. Returns the empty string to represent the no-namespace
-
getLocalPart
Get the local part of the QName- Specified by:
getLocalPart
in interfaceNodeName
- Returns:
- the local part of the QName
-
getDisplayName
Get the display name, that is the lexical QName in the form [prefix:]local-part- Specified by:
getDisplayName
in interfaceNodeName
- Returns:
- the lexical QName
-
getStructuredQName
Get the name in the form of a StructuredQName- Specified by:
getStructuredQName
in interfaceNodeName
- Returns:
- the name in the form of a StructuredQName
-
hasURI
Test whether this name is in a given namespace -
getNamespaceBinding
Get aNamespaceBinding
whose (prefix, uri) pair are the prefix and URI of this node name- Specified by:
getNamespaceBinding
in interfaceNodeName
- Returns:
- the corresponding NamespaceBinding
-
hasFingerprint
public boolean hasFingerprint()Ask whether this node name representation has a known namecode and fingerprint- Specified by:
hasFingerprint
in interfaceNodeName
- Returns:
- true if the methods getFingerprint() and getNameCode() will return a result other than -1
-
getFingerprint
public 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- Specified by:
getFingerprint
in interfaceNodeName
- Returns:
- the fingerprint if known; otherwise -1
-
obtainFingerprint
Get the nameCode of this name, allocating a new code from the namepool if necessary- Specified by:
obtainFingerprint
in interfaceNodeName
- Parameters:
namePool
- the NamePool used to allocate the name- Returns:
- a nameCode for this name, newly allocated if necessary
-
hashCode
public int hashCode()Returns a hash code value for the object. -
equals
Indicates whether some other object is "equal to" this one. -
isIdentical
Determine whether two IdentityComparable objects are identical. This is a stronger test than equality (even schema-equality); for example two dateTime values are not identical unless they are in the same timezone.- Specified by:
isIdentical
in interfaceIdentityComparable
- Parameters:
other
- the value to be compared with- Returns:
- true if the two values are identical, false otherwise
-
identityHashCode
public int identityHashCode()Get a hashCode that offers the guarantee that if A.isIdentical(B), then A.identityHashCode() == B.identityHashCode()- Specified by:
identityHashCode
in interfaceIdentityComparable
- Returns:
- a hashCode suitable for use when testing for identity.
-