Class MergedNsContext

  • All Implemented Interfaces:
    javax.xml.namespace.NamespaceContext

    public class MergedNsContext
    extends BaseNsContext
    Hierarchic NamespaceContext implementation used when constructing event and namespace information explicitly via XMLEventFactory, not by a stream reader.

    TODO:

    • Figure out a way to check for namespace masking; tricky but not impossible to determine
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.List<javax.xml.stream.events.Namespace> mNamespaces
      List of Namespace instances.
      (package private) java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> mNsByPrefix  
      (package private) java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> mNsByURI  
      (package private) javax.xml.namespace.NamespaceContext mParentCtxt  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected MergedNsContext​(javax.xml.namespace.NamespaceContext parentCtxt, java.util.List<javax.xml.stream.events.Namespace> localNs)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> buildByNsURIMap()  
      private java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> buildByPrefixMap()  
      static BaseNsContext construct​(javax.xml.namespace.NamespaceContext parentCtxt, java.util.List<javax.xml.stream.events.Namespace> localNs)  
      java.lang.String doGetNamespaceURI​(java.lang.String prefix)  
      java.lang.String doGetPrefix​(java.lang.String nsURI)  
      java.util.Iterator<java.lang.String> doGetPrefixes​(java.lang.String nsURI)  
      java.util.Iterator<javax.xml.stream.events.Namespace> getNamespaces()
      Method that returns information about namespace definition declared in this scope; not including ones declared in outer scopes.
      void outputNamespaceDeclarations​(java.io.Writer w)
      Method called by the matching start element class to output all namespace declarations active in current namespace scope, if any.
      void outputNamespaceDeclarations​(javax.xml.stream.XMLStreamWriter w)
      Method called by the matching start element class to output all namespace declarations active in current namespace scope, if any.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mParentCtxt

        final javax.xml.namespace.NamespaceContext mParentCtxt
      • mNamespaces

        final java.util.List<javax.xml.stream.events.Namespace> mNamespaces
        List of Namespace instances.
      • mNsByPrefix

        java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> mNsByPrefix
      • mNsByURI

        java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> mNsByURI
    • Constructor Detail

      • MergedNsContext

        protected MergedNsContext​(javax.xml.namespace.NamespaceContext parentCtxt,
                                  java.util.List<javax.xml.stream.events.Namespace> localNs)
    • Method Detail

      • construct

        public static BaseNsContext construct​(javax.xml.namespace.NamespaceContext parentCtxt,
                                              java.util.List<javax.xml.stream.events.Namespace> localNs)
      • doGetPrefix

        public java.lang.String doGetPrefix​(java.lang.String nsURI)
        Specified by:
        doGetPrefix in class BaseNsContext
      • doGetPrefixes

        public java.util.Iterator<java.lang.String> doGetPrefixes​(java.lang.String nsURI)
        Specified by:
        doGetPrefixes in class BaseNsContext
      • getNamespaces

        public java.util.Iterator<javax.xml.stream.events.Namespace> getNamespaces()
        Method that returns information about namespace definition declared in this scope; not including ones declared in outer scopes.
        Specified by:
        getNamespaces in class BaseNsContext
      • outputNamespaceDeclarations

        public void outputNamespaceDeclarations​(java.io.Writer w)
                                         throws java.io.IOException
        Description copied from class: BaseNsContext
        Method called by the matching start element class to output all namespace declarations active in current namespace scope, if any.
        Specified by:
        outputNamespaceDeclarations in class BaseNsContext
        Throws:
        java.io.IOException
      • outputNamespaceDeclarations

        public void outputNamespaceDeclarations​(javax.xml.stream.XMLStreamWriter w)
                                         throws javax.xml.stream.XMLStreamException
        Method called by the matching start element class to output all namespace declarations active in current namespace scope, if any.
        Specified by:
        outputNamespaceDeclarations in class BaseNsContext
        Throws:
        javax.xml.stream.XMLStreamException
      • buildByPrefixMap

        private java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> buildByPrefixMap()
      • buildByNsURIMap

        private java.util.Map<java.lang.String,​javax.xml.stream.events.Namespace> buildByNsURIMap()