Class NSStack

java.lang.Object
org.apache.cxf.helpers.NSStack

public class NSStack extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String uri)
    Add a new declaration to the current scope using a unique prefix and return the prefix.
    void
    add(String prefix, String uri)
    Add a new declaration to the current scope.
    Return the prefix associated with the given namespace name by looking thru all the namespace declarations that are in scope.
    getURI(String prefix)
    Return the namespace name associated with the given prefix by looking thru all the namespace declarations that are in scope.
    void
    pop()
    Leave a scope: this removes any NS declarations that were added in the last scope.
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NSStack

      public NSStack()
  • Method Details

    • push

      public void push()
    • pop

      public void pop()
      Leave a scope: this removes any NS declarations that were added in the last scope. Note that I don't bother to validate that you don't call popScope too many times; that's your problem.
    • add

      public void add(String prefix, String uri)
      Add a new declaration to the current scope. This is visible within the current scope as well as from any nested scopes.
      Parameters:
      prefix - the prefix to be used for this namespace
      uri - the namespace name of this namespace.
    • add

      public String add(String uri)
      Add a new declaration to the current scope using a unique prefix and return the prefix. This is useful when one just wants to add a decl and doesn't want to have to deal with creating unique prefixes. If the namespace name is already declared and in scope, then the previously declared prefix is returned.
      Parameters:
      uri - the namespace name of this namespace
      Returns:
      the unique prefix created or previously declared for this namespace
    • getPrefix

      public String getPrefix(String uri)
      Return the prefix associated with the given namespace name by looking thru all the namespace declarations that are in scope.
      Parameters:
      uri - the namespace name for whom a declared prefix is desired
      Returns:
      the prefix or null if namespace name not found
    • getURI

      public String getURI(String prefix)
      Return the namespace name associated with the given prefix by looking thru all the namespace declarations that are in scope.
      Parameters:
      prefix - the prefix for whom a declared namespace name is desired
      Returns:
      the namespace name or null if prefix not found