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 NamespaceBindingcommonAncestor(NamespaceBinding ns1, NamespaceBinding ns2) intcount(NamespaceBinding fencePost) Return the number of bindings before thefencePost.final NamespaceBindinggetNext()final StringNamespace prefix.final StringgetUri()Namespace uri.static NamespaceBindingmaybeAdd(String prefix, String uri, NamespaceBinding bindings) Append a new NamespaceBinding if not redundant.static final NamespaceBindingnconc(NamespaceBinding list1, NamespaceBinding list2) Chain the first list in front of the second list.voidResolve 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 voidsetNext(NamespaceBinding next) final voidfinal voidtoString()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 namenconccomes 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:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-