Apache CXF API

org.apache.cxf.helpers
Class NSStack

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

public class NSStack
extends Object


Constructor Summary
NSStack()
           
 
Method Summary
 String 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.
 String getPrefix(String uri)
          Return the prefix associated with the given namespace name by looking thru all the namespace declarations that are in scope.
 String 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 push()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NSStack

public NSStack()
Method Detail

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

Apache CXF API

Apache CXF