Package net.sf.saxon.om
Class NamespaceBinding
- java.lang.Object
-
- net.sf.saxon.om.NamespaceBinding
-
- All Implemented Interfaces:
Iterable<NamespaceBinding>
,NamespaceBindingSet
public final class NamespaceBinding extends Object implements NamespaceBindingSet
Represents the binding of a prefix to a URI. Also, in some contexts, represents an unbinding, by virtue of the URI being set to a zero length string.- Since:
- 9.4
-
-
Field Summary
Fields Modifier and Type Field Description static NamespaceBinding
DEFAULT_UNDECLARATION
static NamespaceBinding[]
EMPTY_ARRAY
static NamespaceBinding
XML
-
Constructor Summary
Constructors Constructor Description NamespaceBinding(String prefix, NamespaceUri uri)
Create a binding of a prefix to a URI
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Test if this namespace binding is the same as anotherNamespaceUri
getNamespaceUri()
Get the URI part of the bindingNamespaceUri
getNamespaceUri(String prefix)
String
getPrefix()
Get the prefix part of the bindingint
hashCode()
boolean
isDefaultUndeclaration()
Ask whether this is an undeclaration of the default prefix, that is, a namespace binding corresponding toxmlns=""
boolean
isXmlNamespace()
Ask whether this is a binding for the XML namespaceIterator<NamespaceBinding>
iterator()
Returns an iterator over this singleton set of namespace bindings.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Field Detail
-
XML
public static final NamespaceBinding XML
-
DEFAULT_UNDECLARATION
public static final NamespaceBinding DEFAULT_UNDECLARATION
-
EMPTY_ARRAY
public static final NamespaceBinding[] EMPTY_ARRAY
-
-
Constructor Detail
-
NamespaceBinding
public NamespaceBinding(String prefix, NamespaceUri uri)
Create a binding of a prefix to a URI- Parameters:
prefix
- the prefix: either an NCName, or a zero-length string to bind the default namespace. Must not be null.uri
- the namespace URI: either a URI, or a zero-length string to unbind the prefix. Must not be null.
-
-
Method Detail
-
getNamespaceUri
public NamespaceUri getNamespaceUri(String prefix)
- Specified by:
getNamespaceUri
in interfaceNamespaceBindingSet
-
getPrefix
public String getPrefix()
Get the prefix part of the binding- Returns:
- the prefix. Never null. The zero-length string indicates a binding for the default namespace.
-
getNamespaceUri
public NamespaceUri getNamespaceUri()
Get the URI part of the binding- Returns:
- the URI. Never null. The zero-length string indicates an unbinding of the prefix. For the default namespace (prefix="") this indicates that the prefix refers to names in no namespace; for other prefixes, it indicates that the prefix is not bound to any namespace and therefore cannot be used.
-
isXmlNamespace
public boolean isXmlNamespace()
Ask whether this is a binding for the XML namespace- Returns:
- true if this is the binding of the prefix "xml" to the standard XML namespace.
-
isDefaultUndeclaration
public boolean isDefaultUndeclaration()
Ask whether this is an undeclaration of the default prefix, that is, a namespace binding corresponding toxmlns=""
- Returns:
- true if this corresponding to
xmlns=""
-
iterator
public Iterator<NamespaceBinding> iterator()
Returns an iterator over this singleton set of namespace bindings.- Specified by:
iterator
in interfaceIterable<NamespaceBinding>
- Returns:
- an Iterator.
-
equals
public boolean equals(Object obj)
Test if this namespace binding is the same as another
-
-