gnu.xml
Class NamespaceBinding

java.lang.Object
  extended by gnu.xml.NamespaceBinding
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public final class NamespaceBinding
extends java.lang.Object
implements java.io.Externalizable

A "namespace node" as a link in a linked list.

See Also:
Serialized Form

Field Summary
static NamespaceBinding predefinedXML
           
 
Constructor Summary
NamespaceBinding(java.lang.String prefix, java.lang.String uri, NamespaceBinding next)
           
 
Method Summary
static NamespaceBinding commonAncestor(NamespaceBinding ns1, NamespaceBinding ns2)
           
 int count(NamespaceBinding fencePost)
          Return the number of bindings before the fencePost.
 NamespaceBinding getNext()
           
 java.lang.String getPrefix()
           
 java.lang.String getUri()
           
static NamespaceBinding maybeAdd(java.lang.String prefix, java.lang.String uri, NamespaceBinding bindings)
          Append a new NamespaceBinding if not redundant.
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String resolve(java.lang.String prefix)
          Resolve a prefix.
 java.lang.String resolve(java.lang.String prefix, NamespaceBinding fencePost)
          Resolve a prefix, in the initial part of this list.
 NamespaceBinding reversePrefix(NamespaceBinding fencePost)
          Reverse the chain, until a fencePost.
 void setNext(NamespaceBinding next)
           
 void setPrefix(java.lang.String prefix)
           
 void setUri(java.lang.String uri)
           
 java.lang.String toString()
          Return a String showing just a single namespace binding.
 java.lang.String toStringAll()
          Return a String showing the full namespace binding list.
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

predefinedXML

public static final NamespaceBinding predefinedXML
Constructor Detail

NamespaceBinding

public NamespaceBinding(java.lang.String prefix,
                        java.lang.String uri,
                        NamespaceBinding next)
Method Detail

getPrefix

public final java.lang.String getPrefix()

getUri

public final java.lang.String getUri()

getNext

public final NamespaceBinding getNext()

setPrefix

public final void setPrefix(java.lang.String prefix)

setUri

public final void setUri(java.lang.String uri)

setNext

public final void setNext(NamespaceBinding next)

resolve

public java.lang.String resolve(java.lang.String prefix)
Resolve a prefix.

Parameters:
prefix - an interned namespace prefix to search for.
Returns:
a uri or null if not bound

resolve

public java.lang.String resolve(java.lang.String prefix,
                                NamespaceBinding fencePost)
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

public static NamespaceBinding commonAncestor(NamespaceBinding ns1,
                                              NamespaceBinding ns2)

reversePrefix

public NamespaceBinding reversePrefix(NamespaceBinding fencePost)
Reverse the chain, until a fencePost.


count

public int count(NamespaceBinding fencePost)
Return the number of bindings before the fencePost.


maybeAdd

public static NamespaceBinding maybeAdd(java.lang.String prefix,
                                        java.lang.String uri,
                                        NamespaceBinding bindings)
Append a new NamespaceBinding if not redundant.


toString

public java.lang.String toString()
Return a String showing just a single namespace binding.

Overrides:
toString in class java.lang.Object

toStringAll

public java.lang.String toStringAll()
Return a String showing the full namespace binding list.


writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException