Package org.codehaus.staxmate.out
Class SMGlobalNamespace
- java.lang.Object
-
- org.codehaus.staxmate.out.SMNamespace
-
- org.codehaus.staxmate.out.SMGlobalNamespace
-
public final class SMGlobalNamespace extends SMNamespace
Namespace that is global and shared for allSMOutputContext
)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
Fields Modifier and Type Field Description protected java.lang.String
_prefix
Prefix this namespace is (permanently) bound to.-
Fields inherited from class org.codehaus.staxmate.out.SMNamespace
_uri
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SMGlobalNamespace(java.lang.String uri, java.lang.String prefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.protected void
_unbind()
Method called to indicate that the namespace is no longer bound to its current prefix within the current output context.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).-
Methods inherited from class org.codehaus.staxmate.out.SMNamespace
getURI, isBoundToPrefix
-
-
-
-
Method Detail
-
getPreferredPrefix
public java.lang.String getPreferredPrefix()
- Specified by:
getPreferredPrefix
in classSMNamespace
- 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 classSMNamespace
-
getLastBoundPrefix
public java.lang.String getLastBoundPrefix()
- Specified by:
getLastBoundPrefix
in classSMNamespace
-
prefersDefaultNs
public boolean prefersDefaultNs()
- Specified by:
prefersDefaultNs
in classSMNamespace
-
prefersDefaultNs
public void prefersDefaultNs(boolean state)
- Specified by:
prefersDefaultNs
in classSMNamespace
-
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 classSMNamespace
-
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 classSMNamespace
-
_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 classSMNamespace
-
_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 classSMNamespace
-
_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 classSMNamespace
-
-