Class OutputElement


  • final class OutputElement
    extends java.lang.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 Detail

      • _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 java.lang.String _uri
        Namespace of the element, whatever prefix part of _name maps to. Non-final to allow reuse.
      • _defaultNsURI

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

      • OutputElement

        private OutputElement()
    • Method Detail

      • 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,
                                            java.lang.String uri)
        Full factory method, used for 'normal' namespace qualified output methods.
      • 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,
                            java.lang.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.
      • isRoot

        public boolean isRoot()
      • getName

        public WName getName()
      • getLocalName

        public java.lang.String getLocalName()
      • getNonNullPrefix

        public java.lang.String getNonNullPrefix()
      • hasPrefix

        public boolean hasPrefix()
      • getNameDesc

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

        public java.lang.String getNamespaceURI()
      • getNonNullNamespaceURI

        public java.lang.String getNonNullNamespaceURI()
      • getDefaultNsURI

        public java.lang.String getDefaultNsURI()
      • hasEmptyDefaultNs

        public boolean hasEmptyDefaultNs()
      • getQName

        public javax.xml.namespace.QName getQName()
      • setDefaultNsURI

        public void setDefaultNsURI​(java.lang.String uri)
      • generatePrefix

        public java.lang.String generatePrefix​(javax.xml.namespace.NamespaceContext rootNsContext,
                                               java.lang.String prefixBase,
                                               int[] seqArr)
      • addPrefix

        public void addPrefix​(java.lang.String prefix,
                              java.lang.String uri)
      • getNamespaceURI

        public java.lang.String getNamespaceURI​(java.lang.String prefix)
      • getPrefix

        public java.lang.String getPrefix​(java.lang.String uri)
      • getPrefixes

        public java.util.Iterator<java.lang.String> getPrefixes​(java.lang.String uri,
                                                                javax.xml.namespace.NamespaceContext rootNsContext)
      • getExplicitPrefix

        public java.lang.String getExplicitPrefix​(java.lang.String uri,
                                                  javax.xml.namespace.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​(java.lang.String prefix,
                                                             java.lang.String nsURI,
                                                             javax.xml.namespace.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​(java.lang.String prefix,
                                       java.lang.String nsURI,
                                       javax.xml.namespace.NamespaceContext rootNsContext)
      • isPrefixUnbound

        public boolean isPrefixUnbound​(java.lang.String prefix,
                                       javax.xml.namespace.NamespaceContext rootNsContext)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object