Class NameSpaceSymbTable


  • public class NameSpaceSymbTable
    extends java.lang.Object
    A stack based Symbol Table.
    For speed reasons all the symbols are introduced in the same map, and at the same time in a list so it can be removed when the frame is pop back.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private boolean cloned  
      private static SymbMap initialMap  
      private java.util.List<SymbMap> level
      The stacks for removing the definitions when doing pop.
      private SymbMap symb
      The map betwen prefix-> entry table.
      private static java.lang.String XMLNS  
    • Constructor Summary

      Constructors 
      Constructor Description
      NameSpaceSymbTable()
      Default constractor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addMapping​(java.lang.String prefix, java.lang.String uri, org.w3c.dom.Attr n)
      Adds the mapping for a prefix.
      org.w3c.dom.Node addMappingAndRender​(java.lang.String prefix, java.lang.String uri, org.w3c.dom.Attr n)
      Adds a definition and mark it as render.
      int getLevel()  
      org.w3c.dom.Attr getMapping​(java.lang.String prefix)
      Gets the attribute node that defines the binding for the prefix.
      org.w3c.dom.Attr getMappingWithoutRendered​(java.lang.String prefix)
      Gets a definition without mark it as render.
      void getUnrenderedNodes​(java.util.Collection<org.w3c.dom.Attr> result)
      Get all the unrendered nodes in the name space.
      (package private) void needsClone()  
      void outputNodePop()
      Pop a frame for visible namespace.
      void outputNodePush()
      Push a frame for visible namespace.
      void pop()
      Pop a frame.
      void push()
      Push a frame for a node.
      void removeMapping​(java.lang.String prefix)  
      void removeMappingIfNotRender​(java.lang.String prefix)  
      boolean removeMappingIfRender​(java.lang.String prefix)  
      • Methods inherited from class java.lang.Object

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

      • initialMap

        private static final SymbMap initialMap
      • symb

        private SymbMap symb
        The map betwen prefix-> entry table.
      • level

        private java.util.List<SymbMap> level
        The stacks for removing the definitions when doing pop.
      • cloned

        private boolean cloned
    • Constructor Detail

      • NameSpaceSymbTable

        public NameSpaceSymbTable()
        Default constractor
    • Method Detail

      • getUnrenderedNodes

        public void getUnrenderedNodes​(java.util.Collection<org.w3c.dom.Attr> result)
        Get all the unrendered nodes in the name space. For Inclusive rendering
        Parameters:
        result - the list where to fill the unrendered xmlns definitions.
      • outputNodePush

        public void outputNodePush()
        Push a frame for visible namespace. For Inclusive rendering.
      • outputNodePop

        public void outputNodePop()
        Pop a frame for visible namespace.
      • push

        public void push()
        Push a frame for a node. Inclusive or Exclusive.
      • pop

        public void pop()
        Pop a frame. Inclusive or Exclusive.
      • needsClone

        final void needsClone()
      • getMapping

        public org.w3c.dom.Attr getMapping​(java.lang.String prefix)
        Gets the attribute node that defines the binding for the prefix.
        Parameters:
        prefix - the prefix to obtain the attribute.
        Returns:
        null if there is no need to render the prefix. Otherwise the node of definition.
      • getMappingWithoutRendered

        public org.w3c.dom.Attr getMappingWithoutRendered​(java.lang.String prefix)
        Gets a definition without mark it as render. For render in exclusive c14n the namespaces in the include prefixes.
        Parameters:
        prefix - The prefix whose definition is neaded.
        Returns:
        the attr to render, null if there is no need to render
      • addMapping

        public boolean addMapping​(java.lang.String prefix,
                                  java.lang.String uri,
                                  org.w3c.dom.Attr n)
        Adds the mapping for a prefix.
        Parameters:
        prefix - the prefix of definition
        uri - the Uri of the definition
        n - the attribute that have the definition
        Returns:
        true if there is already defined.
      • addMappingAndRender

        public org.w3c.dom.Node addMappingAndRender​(java.lang.String prefix,
                                                    java.lang.String uri,
                                                    org.w3c.dom.Attr n)
        Adds a definition and mark it as render. For inclusive c14n.
        Parameters:
        prefix - the prefix of definition
        uri - the Uri of the definition
        n - the attribute that have the definition
        Returns:
        the attr to render, null if there is no need to render
      • getLevel

        public int getLevel()
      • removeMapping

        public void removeMapping​(java.lang.String prefix)
      • removeMappingIfNotRender

        public void removeMappingIfNotRender​(java.lang.String prefix)
      • removeMappingIfRender

        public boolean removeMappingIfRender​(java.lang.String prefix)