Class SMOutputContext

java.lang.Object
org.codehaus.staxmate.out.SMOutputContext

public final class SMOutputContext extends Object
Class that encapsulates details about context in which StaxMate output is done. The most important of the details is the stream writer to use (since that is eventually invoked to do the real output), and its properties.

Usually the process of outputting XML content with StaxMate starts by instantiating an SMOutputContext. It can then be used to create output fragments; all of which bind to that context. Context is thus what "connects" various fragments when they are buffered (when there may or may not be child/parent relationships yet defined).

Context is also used (in addition to storing output relevant settings and acting as a fragment factory) as the owner of various other objects, most notable namespaces. All local namespaces are owned by one and only one context.

  • Field Details

    • DEF_NS_STACK_SIZE

      protected static final int DEF_NS_STACK_SIZE
      See Also:
    • NS_EMPTY

      protected static final SMNamespace NS_EMPTY
    • NS_XML

      protected static final SMNamespace NS_XML
    • NS_XMLNS

      protected static final SMNamespace NS_XMLNS
    • sGlobalNsMap

      protected static final HashMap<String, SMNamespace> sGlobalNsMap
    • FALSE_VALUE

      protected static final SMOTypedValue FALSE_VALUE
    • TRUE_VALUE

      protected static final SMOTypedValue TRUE_VALUE
    • _streamWriter

      protected final org.codehaus.stax2.XMLStreamWriter2 _streamWriter
    • _rootNsContext

      protected final NamespaceContext _rootNsContext
    • _cfgRepairing

      protected final boolean _cfgRepairing
    • _nsPrefixPrefix

      protected String _nsPrefixPrefix
      Prefix to use for creating automatic namespace prefixes. For example, setting this to "ns" would result in automatic prefixes of form "ns1", "ns2" and so on.
    • _nsPrefixSeqNr

      protected int _nsPrefixSeqNr
    • _cfgPreferDefaultNs

      protected boolean _cfgPreferDefaultNs
      Configuration flag that specifies whether by default namespaces should bind as the default namespaces for elements or not. If true, all unbound namespaces are always bound as the default namespace, when elements are output: if false, more complicated logics is used (which considers preferred prefixes, past bindings etc).
    • _localNsMap

      protected HashMap<String, SMNamespace> _localNsMap
      Map that contains all local namespaces, that is, namespaces that have been created for use with documents output using this context.
    • _defaultNS

      protected SMNamespace _defaultNS
      Currently active default namespace; one that is in effect within current scope (inside currently open element, if any; if none, within root level).
  • Constructor Details

    • SMOutputContext

      protected SMOutputContext(org.codehaus.stax2.XMLStreamWriter2 sw, NamespaceContext rootNsCtxt)
  • Method Details