public final class SMLocalNamespace extends SMNamespace
SMOutputContext), think of it as the document or sub-tree
StaxMate will output using a stream writer).| Modifier and Type | Field and Description |
|---|---|
protected SMOutputContext |
_context
Output context in which this namespace is to be used (scope of
which it is bound)
|
protected String |
_currPrefix
Prefix this namespace is currently bound to, if any.
|
protected boolean |
_isPermanent
Flag that indicates whether this binding (with current prefix) is
permanent or not; that is, whether prefix associated with the
namespace URI can still change or not.
|
protected boolean |
_preferDefaultNs
Flag that indicates whether this namespaces prefers to be bound
as the default namespace (for elements), or not.
|
protected String |
_preferredPrefix
Preferred (or suggested) prefix for the namespace;
StaxMate will try to use this prefix if possible when binding
namespaces and also passes it to the underlying stream writer.
|
protected String |
_prevPrefix
Last prefix this name was bound to, if any.
|
_uri| Modifier | Constructor and Description |
|---|---|
protected |
SMLocalNamespace(SMOutputContext ctxt,
String uri,
boolean preferDefaultNs,
String prefPrefix) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
_bindAs(String prefix)
The only trick with regard to binding/unbinding of local namespaces
is that "re-binding" is not allowed (by StaxMate design; XML would
allow it).
|
protected void |
_bindPermanentlyAs(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.
|
String |
getBoundPrefix() |
String |
getLastBoundPrefix() |
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(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).
|
getURI, isBoundToPrefixprotected final SMOutputContext _context
protected String _preferredPrefix
This value will be automatically set when namespace is created, and there is also a way to explicitly set it. Finally, it will also be set if a dynamic prefix is created for the namespace
protected String _currPrefix
protected String _prevPrefix
protected boolean _preferDefaultNs
protected boolean _isPermanent
protected SMLocalNamespace(SMOutputContext ctxt, String uri, boolean preferDefaultNs, String prefPrefix)
ctxt - Output context that "owns" this namespace (within which
namespace will be bound when output)uri - URI that defines identity of the namespaceprefPrefix - Prefererred (or suggested) prefix for the namespace;
StaxMate will try to use this prefix if possible when binding
namespaces and also passes it to the underlying stream writer.preferDefaultNs - Whether this namespaces prefers to be bound
as the default namespace when used for elements.public String getPreferredPrefix()
getPreferredPrefix in class SMNamespacepublic String getBoundPrefix()
getBoundPrefix in class SMNamespacepublic String getLastBoundPrefix()
getLastBoundPrefix in class SMNamespacepublic boolean prefersDefaultNs()
prefersDefaultNs in class SMNamespacepublic void prefersDefaultNs(boolean state)
prefersDefaultNs in class SMNamespacepublic void setPreferredPrefix(String prefPrefix)
SMNamespacesetPreferredPrefix in class SMNamespaceprotected boolean isValidIn(SMOutputContext ctxt)
SMNamespaceisValidIn in class SMNamespaceprotected void _bindAs(String prefix)
_bindAs in class SMNamespaceprotected void _bindPermanentlyAs(String prefix)
SMNamespace_bindPermanentlyAs in class SMNamespaceprotected void _unbind()
SMNamespace_unbind in class SMNamespaceCopyright © 2025 FasterXML. All rights reserved.