Package gnu.xml
Class NamespaceBinding
java.lang.Object
gnu.xml.NamespaceBinding
- All Implemented Interfaces:
Externalizable
,Serializable
A "namespace node" as a link in a linked list.
The list may contain duplicates - i.e. multiple namespace bindings
for the same prefix but (usually) different uris. In that case the
first binding "wins". One reason for allowing duplicates it to allow
sharing of the lists between a child and its parent element.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NamespaceBinding
commonAncestor
(NamespaceBinding ns1, NamespaceBinding ns2) int
count
(NamespaceBinding fencePost) Return the number of bindings before thefencePost
.final NamespaceBinding
getNext()
final String
Namespace prefix.final String
getUri()
Namespace uri.static NamespaceBinding
maybeAdd
(String prefix, String uri, NamespaceBinding bindings) Append a new NamespaceBinding if not redundant.static final NamespaceBinding
nconc
(NamespaceBinding list1, NamespaceBinding list2) Chain the first list in front of the second list.void
Resolve a prefix.resolve
(String prefix, NamespaceBinding fencePost) Resolve a prefix, in the initial part of this list.reversePrefix
(NamespaceBinding fencePost) Reverse the chain, until a fencePost.final void
setNext
(NamespaceBinding next) final void
final void
toString()
Return a String showing just a single namespace binding.Return a String showing the full namespace binding list.void
-
Field Details
-
XML_NAMESPACE
- See Also:
-
predefinedXML
-
-
Constructor Details
-
NamespaceBinding
-
-
Method Details
-
getPrefix
Namespace prefix. An interned String. A default namespace declaration is represented using null. -
setPrefix
-
getUri
Namespace uri. An interned String. The value null "undeclares" any following namespaces with the same prefix; it corresponds to an empty uri as in the XML Namespaces 1.1 Candidate Recommendation. -
setUri
-
getNext
-
setNext
-
nconc
Chain the first list in front of the second list. (The namenconc
comes from Common Lisp.) -
resolve
Resolve a prefix.- Parameters:
prefix
- an interned namespace prefix to search for.- Returns:
- a uri or null if not bound
-
resolve
Resolve a prefix, in the initial part of this list.- Parameters:
prefix
- an interned namespace prefix to search for.fencePost
- only search this list until then.- Returns:
- a uri or null if not bound
-
commonAncestor
-
reversePrefix
Reverse the chain, until a fencePost. -
count
Return the number of bindings before thefencePost
. -
maybeAdd
Append a new NamespaceBinding if not redundant. -
toString
Return a String showing just a single namespace binding. -
toStringAll
Return a String showing the full namespace binding list. -
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-