org.codehaus.staxmate.out
Class SMGlobalNamespace

java.lang.Object
  extended by org.codehaus.staxmate.out.SMNamespace
      extended by org.codehaus.staxmate.out.SMGlobalNamespace

public final class SMGlobalNamespace
extends SMNamespace

Namespace that is global and shared for all SMOutputContext)s (~= XML documents or sub-trees). This includes the pre-defined namespaces (ones with "xml" and "xmlns" prefixes as well as the default "empty"/missing namespace, one bound to "" if no explicit declaration is made).


Field Summary
protected  java.lang.String mPrefix
          Prefix this namespace is (permanently) bound to.
 
Fields inherited from class org.codehaus.staxmate.out.SMNamespace
mURI
 
Constructor Summary
protected SMGlobalNamespace(java.lang.String uri, java.lang.String prefix)
           
 
Method Summary
protected  void bindAs(java.lang.String prefix)
          Global namespaces should never be bound/unbound, so if this gets called, an exception will be thrown (but note that this being an 'internal' method, this is more like an assertion).
protected  void bindPermanentlyAs(java.lang.String prefix)
          Method used to permanently bind this (local) namespace to a prefix.
 java.lang.String getBoundPrefix()
           
 java.lang.String getLastBoundPrefix()
           
 java.lang.String getPreferredPrefix()
           
protected  boolean isValidIn(SMOutputContext ctxt)
          Method used to verify that the namespace is actually valid within the specified output context.
 boolean prefersDefaultNs()
           
 void prefersDefaultNs(boolean state)
           
 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).
protected  void unbind()
          Method called to indicate that the namespace is no longer bound to its current prefix within the current output context.
 
Methods inherited from class org.codehaus.staxmate.out.SMNamespace
getURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mPrefix

protected final java.lang.String mPrefix
Prefix this namespace is (permanently) bound to.

Constructor Detail

SMGlobalNamespace

protected SMGlobalNamespace(java.lang.String uri,
                            java.lang.String prefix)
Method Detail

getPreferredPrefix

public java.lang.String getPreferredPrefix()
Specified by:
getPreferredPrefix in class SMNamespace
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 java.lang.String getBoundPrefix()
Specified by:
getBoundPrefix in class SMNamespace

getLastBoundPrefix

public java.lang.String getLastBoundPrefix()
Specified by:
getLastBoundPrefix in class SMNamespace

prefersDefaultNs

public boolean prefersDefaultNs()
Specified by:
prefersDefaultNs in class SMNamespace

prefersDefaultNs

public void prefersDefaultNs(boolean state)
Specified by:
prefersDefaultNs in class SMNamespace

setPreferredPrefix

public void setPreferredPrefix(java.lang.String prefPrefix)
Description copied from class: SMNamespace
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).

Specified by:
setPreferredPrefix in class SMNamespace

isValidIn

protected boolean isValidIn(SMOutputContext ctxt)
Description copied from class: SMNamespace
Method used to verify that the namespace is actually valid within the specified output context.

Specified by:
isValidIn in class SMNamespace

bindAs

protected void bindAs(java.lang.String prefix)
Global namespaces should never be bound/unbound, so if this gets called, an exception will be thrown (but note that this being an 'internal' method, this is more like an assertion).

Specified by:
bindAs in class SMNamespace

bindPermanentlyAs

protected void bindPermanentlyAs(java.lang.String prefix)
Description copied from class: SMNamespace
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.

Specified by:
bindPermanentlyAs in class SMNamespace

unbind

protected void unbind()
Description copied from class: SMNamespace
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.

Specified by:
unbind in class SMNamespace