Class NamespaceStack

java.lang.Object
org.apache.maven.archetype.common.util.NamespaceStack
Direct Known Subclasses:
XMLOutputter.NamespaceStack

class NamespaceStack extends Object
A non-public utility class used by XMLOutputter to manage namespaces in a JDOM Document during output.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Stack<String>
    The prefixes available
    private Stack<String>
    The URIs available
  • Constructor Summary

    Constructors
    Constructor
    Description
    This creates the needed storage.
  • Method Summary

    Modifier and Type
    Method
    Description
    getURI(String prefix)
    Given a prefix, this will return the namespace URI most rencently (topmost) associated with that prefix.
    pop()
    This will remove the topmost (most recently added) Namespace, and return its prefix.
    void
    push(org.jdom.Namespace ns)
    This will add a new Namespace to those currently available.
    int
    This returns the number of available namespaces.
    This will print out the size and current stack, from the most recently added Namespace to the "oldest," all to System.out.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • prefixes

      private Stack<String> prefixes
      The prefixes available
    • uris

      private Stack<String> uris
      The URIs available
  • Constructor Details

    • NamespaceStack

      NamespaceStack()
      This creates the needed storage.
  • Method Details

    • push

      public void push(org.jdom.Namespace ns)
      This will add a new Namespace to those currently available.
      Parameters:
      ns - Namespace to add.
    • pop

      public String pop()
      This will remove the topmost (most recently added) Namespace, and return its prefix.
      Returns:
      String - the popped namespace prefix.
    • size

      public int size()
      This returns the number of available namespaces.
      Returns:
      int - size of the namespace stack.
    • getURI

      public String getURI(String prefix)
      Given a prefix, this will return the namespace URI most rencently (topmost) associated with that prefix.
      Parameters:
      prefix - String namespace prefix.
      Returns:
      String - the namespace URI for that prefix.
    • toString

      public String toString()
      This will print out the size and current stack, from the most recently added Namespace to the "oldest," all to System.out.
      Overrides:
      toString in class Object