Class OutputElement

java.lang.Object
com.fasterxml.aalto.out.OutputElement

final class OutputElement extends Object
Simple container for information regarding an open element within stream writer output.

Note: these elements are designed to be reused within context of a single document output, ie. they are owned by the stream writer, and can be recycled by it, as necessary.

  • Field Details

    • BYTE_LT

      static final byte BYTE_LT
      See Also:
    • BYTE_GT

      static final byte BYTE_GT
      See Also:
    • BYTE_SLASH

      static final byte BYTE_SLASH
      See Also:
    • _parent

      private OutputElement _parent
      Reference to either the parent (enclosing element) of this element, when part of active output context; or link to next reusable unused element after this one (if not part of active context).
    • _name

      private WName _name
      Prefixed name used for serialization.
    • _uri

      private String _uri
      Namespace of the element, whatever prefix part of _name maps to. Non-final to allow reuse.
    • _defaultNsURI

      private String _defaultNsURI
      Namespace context end application may have supplied, and that (if given) should be used to augment explicitly defined bindings.
    • _nsBinder

      private NsBinder _nsBinder
  • Constructor Details

  • Method Details

    • createRoot

      protected static OutputElement createRoot()
    • createChild

      protected OutputElement createChild(WName name)
      Simplest factory method, which gets called when non-namespace element output method is called. It is, then, assumed to use the default namespce.
    • createChild

      protected OutputElement createChild(WName name, String uri)
      Full factory method, used for 'normal' namespace qualified output methods.
    • reuseAsChild

      protected OutputElement reuseAsChild(OutputElement parent, WName name)
      Returns:
      New head of the recycle pool
    • reuseAsChild

      protected OutputElement reuseAsChild(OutputElement parent, WName name, String nsURI)
    • relink

      public void relink(OutputElement parent)
      Method called to reuse a recycled instance, as is, with same name.
    • relink

      private void relink(OutputElement parent, WName name, String uri)
      Method called to reuse a pooled instance, but with different name
    • addToPool

      protected void addToPool(OutputElement poolHead)
      Method called to temporarily link this instance to a pool, to allow reusing of instances with the same reader.
    • getParent

      public OutputElement getParent()
    • isRoot

      public boolean isRoot()
    • getName

      public WName getName()
    • getLocalName

      public String getLocalName()
    • getNonNullPrefix

      public String getNonNullPrefix()
    • hasPrefix

      public boolean hasPrefix()
    • getNameDesc

      public String getNameDesc()
      Returns:
      String presentation of the fully-qualified name, in "prefix:localName" format (no URI). Useful for error and debugging messages.
    • getNamespaceURI

      public String getNamespaceURI()
    • getNonNullNamespaceURI

      public String getNonNullNamespaceURI()
    • getDefaultNsURI

      public String getDefaultNsURI()
    • hasEmptyDefaultNs

      public boolean hasEmptyDefaultNs()
    • getQName

      public QName getQName()
    • setDefaultNsURI

      public void setDefaultNsURI(String uri)
    • generatePrefix

      public String generatePrefix(NamespaceContext rootNsContext, String prefixBase, int[] seqArr)
    • addPrefix

      public void addPrefix(String prefix, String uri)
    • getNamespaceURI

      public String getNamespaceURI(String prefix)
    • getPrefix

      public String getPrefix(String uri)
    • getPrefixes

      public Iterator<String> getPrefixes(String uri, NamespaceContext rootNsContext)
    • getExplicitPrefix

      public String getExplicitPrefix(String uri, NamespaceContext rootNsContext)
      Method similar to getPrefix(java.lang.String), but one that will not accept the default namespace, only an explicit one. Usually used when trying to find a prefix for attributes.
    • checkPrefixValidity

      public OutputElement.PrefixState checkPrefixValidity(String prefix, String nsURI, NamespaceContext rootNsContext)
      Method that verifies that passed-in non-empty prefix indeed maps to specified non-empty namespace URI; and depending on how it goes returns a status for caller.
      Returns:
      OK, if passed-in prefix matches matched-in namespace URI in current scope; UNBOUND if it's not bound to anything, and MISBOUND if it's bound to another URI.
    • isPrefixBoundTo

      public boolean isPrefixBoundTo(String prefix, String nsURI, NamespaceContext rootNsContext)
    • isPrefixUnbound

      public boolean isPrefixUnbound(String prefix, NamespaceContext rootNsContext)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object