com.simonstl.common
Class NSContext

java.lang.Object
  |
  +--com.simonstl.common.NSContext
All Implemented Interfaces:
NamespaceStackI

public class NSContext
extends java.lang.Object
implements NamespaceStackI

Derived from the com.simonstl.moe.NamespaceContext class and the com.simonstl.midp.xml.TAMNSContext class.

Version:
0.04 13 December 2002
Author:
Simon St.Laurent

Field Summary
protected  int level
           
protected  boolean modified
           
protected  java.util.Vector namespaceStack
           
protected  java.util.Hashtable nsByPrefix
           
 
Constructor Summary
NSContext()
           
 
Method Summary
 void declarePrefix(NSDecl namespace)
           
 void declarePrefix(java.lang.String prefix, java.lang.String URI)
          Accepts a namespace declaration mapping a prefix to a URI.
protected  void generateSets()
           
 int getLevel()
           
 java.lang.String getPrefix(java.lang.String URI)
          Returns a prefix which currently maps to a particular URI.
 java.lang.String getUri(java.lang.String prefix)
          Returns the URI which currently maps to a particular prefix.
static void main(java.lang.String[] args)
           
 void popLevel()
          Pops the element level up one to undeclare namespaces whose scope is done.
static void printPop(NSContext subject)
           
static void printPush(NSContext subject)
           
 void pushLevel()
          Pushes the element level one deeper for namespace-nesting.
protected  boolean removeNamespaces(int removeLevel)
           
 void reset()
          clear everything in the namespace stack
static java.lang.String test()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

level

protected int level

modified

protected boolean modified

namespaceStack

protected java.util.Vector namespaceStack

nsByPrefix

protected java.util.Hashtable nsByPrefix
Constructor Detail

NSContext

public NSContext()
Method Detail

declarePrefix

public void declarePrefix(java.lang.String prefix,
                          java.lang.String URI)
Description copied from interface: NamespaceStackI
Accepts a namespace declaration mapping a prefix to a URI.

Specified by:
declarePrefix in interface NamespaceStackI

declarePrefix

public void declarePrefix(NSDecl namespace)

generateSets

protected void generateSets()

getUri

public java.lang.String getUri(java.lang.String prefix)
Description copied from interface: NamespaceStackI
Returns the URI which currently maps to a particular prefix.

Specified by:
getUri in interface NamespaceStackI

getPrefix

public java.lang.String getPrefix(java.lang.String URI)
Description copied from interface: NamespaceStackI
Returns a prefix which currently maps to a particular URI. There can be multiple prefixes for a particular URI, and this method only promises to return one of them.

Specified by:
getPrefix in interface NamespaceStackI

pushLevel

public void pushLevel()
Description copied from interface: NamespaceStackI
Pushes the element level one deeper for namespace-nesting.

Specified by:
pushLevel in interface NamespaceStackI

popLevel

public void popLevel()
Description copied from interface: NamespaceStackI
Pops the element level up one to undeclare namespaces whose scope is done.

Specified by:
popLevel in interface NamespaceStackI

removeNamespaces

protected boolean removeNamespaces(int removeLevel)

getLevel

public int getLevel()

reset

public void reset()
Description copied from interface: NamespaceStackI
clear everything in the namespace stack

Specified by:
reset in interface NamespaceStackI

printPush

public static void printPush(NSContext subject)

printPop

public static void printPop(NSContext subject)

test

public static java.lang.String test()

main

public static void main(java.lang.String[] args)