Class SMNamespace

  • Direct Known Subclasses:
    SMGlobalNamespace, SMLocalNamespace

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

      Fields 
      Modifier and Type Field Description
      protected java.lang.String _uri
      URI of the actual namespace this class encapsulates
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected SMNamespace​(java.lang.String uri)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract void _bindAs​(java.lang.String prefix)
      Method called to indicate that the namespace is now bound to a specific prefix within current output context.
      protected abstract void _bindPermanentlyAs​(java.lang.String prefix)
      Method used to permanently bind this (local) namespace to a prefix.
      protected abstract void _unbind()
      Method called to indicate that the namespace is no longer bound to its current prefix within the current output context.
      abstract java.lang.String getBoundPrefix()  
      abstract java.lang.String getLastBoundPrefix()  
      abstract java.lang.String getPreferredPrefix()  
      java.lang.String getURI()  
      boolean isBoundToPrefix()  
      protected abstract boolean isValidIn​(SMOutputContext ctxt)
      Method used to verify that the namespace is actually valid within the specified output context.
      abstract boolean prefersDefaultNs()  
      abstract void prefersDefaultNs​(boolean state)  
      abstract void setPreferredPrefix​(java.lang.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).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _uri

        protected final java.lang.String _uri
        URI of the actual namespace this class encapsulates
    • Constructor Detail

      • SMNamespace

        protected SMNamespace​(java.lang.String uri)
    • Method Detail

      • getURI

        public final java.lang.String getURI()
      • getPreferredPrefix

        public abstract java.lang.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 java.lang.String getBoundPrefix()
      • getLastBoundPrefix

        public abstract java.lang.String getLastBoundPrefix()
      • prefersDefaultNs

        public abstract boolean prefersDefaultNs()
      • isBoundToPrefix

        public final boolean isBoundToPrefix()
      • prefersDefaultNs

        public abstract void prefersDefaultNs​(boolean state)
      • setPreferredPrefix

        public abstract void setPreferredPrefix​(java.lang.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​(java.lang.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​(java.lang.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.