Class SMNamespace

java.lang.Object
org.codehaus.staxmate.out.SMNamespace
Direct Known Subclasses:
SMGlobalNamespace, SMLocalNamespace

public abstract class SMNamespace extends Object
Abstract base class for all namespace objects (local and global ones).
  • Field Details

    • _uri

      protected final String _uri
      URI of the actual namespace this class encapsulates
  • Constructor Details

    • SMNamespace

      protected SMNamespace(String uri)
  • Method Details

    • getURI

      public final String getURI()
    • getPreferredPrefix

      public abstract String getPreferredPrefix()
      Returns:
      Prefix that the caller application has at some point indicated to be a prefix it'd like to see; StaxMate may try to use it as the prefix to bind if there are no
    • getBoundPrefix

      public abstract String getBoundPrefix()
    • getLastBoundPrefix

      public abstract String getLastBoundPrefix()
    • prefersDefaultNs

      public abstract boolean prefersDefaultNs()
    • isBoundToPrefix

      public final boolean isBoundToPrefix()
    • prefersDefaultNs

      public abstract void prefersDefaultNs(boolean state)
    • setPreferredPrefix

      public abstract void setPreferredPrefix(String prefPrefix)
      Method that can be called to associate a "preferred" prefix; prefix that this namespace should be bound to instead of some automatically generated one (unless that prefix is already bound to another URI).
    • isValidIn

      protected abstract boolean isValidIn(SMOutputContext ctxt)
      Method used to verify that the namespace is actually valid within the specified output context.
    • _bindAs

      protected abstract void _bindAs(String prefix)
      Method called to indicate that the namespace is now bound to a specific prefix within current output context. Note that this will not be called when the namespace is defined as the default namespace, but only when it is also bound to a prefix.
    • _bindPermanentlyAs

      protected abstract void _bindPermanentlyAs(String prefix)
      Method used to permanently bind this (local) namespace to a prefix. Generally called if a new "global" binding is found at point where a global instance can not be created. Calling this method will essentially mark a local instace as behaving similar to a global one.
    • _unbind

      protected abstract void _unbind()
      Method called to indicate that the namespace is no longer bound to its current prefix within the current output context. Since default namespace declarations do not cause binding, this method will not be called for default namespaces either.