org.jdom.output
Class NamespaceStack


class NamespaceStack

NamespaceStack is a helper class used by both XMLOutputter and SAXOutputter to manage namespaces in a JDOM Document during output.

Author:
Elliotte Rusty Harolde, Fred Trimble, Brett McLaughlin

Constructor Summary
NamespaceStack()
           This creates the needed storage.

Method Summary
 StringgetURI(String prefix)
           Given a prefix, this will return the namespace URI most rencently (topmost) associated with that prefix.
 Stringpop()
           This will remove the topmost (most recently added) Namespace, and return its prefix.
 voidprintStack()
           This will print out the size and current stack, from the most recently added Namespace to the "oldest," all to System.out.
 voidpush(Namespace ns)
           This will add a new Namespace to those currently available.
 intsize()
           This returns the number of available namespaces.

Constructor Detail

NamespaceStack

public NamespaceStack()

This creates the needed storage.

Method Detail

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.

pop

public String pop()

This will remove the topmost (most recently added) Namespace, and return its prefix.

Returns: String - the popped namespace prefix.

printStack

public void printStack()

This will print out the size and current stack, from the most recently added Namespace to the "oldest," all to System.out.


push

public void push(Namespace ns)

This will add a new Namespace to those currently available.

Parameters:
ns - Namespace to add.

size

public int size()

This returns the number of available namespaces.

Returns: int - size of the namespace stack.

Association Links

to Class java.util.Stack

The prefixes available

to Class java.util.Stack

The URIs available