Class NamespaceStack
java.lang.Object
org.apache.maven.archetype.common.util.NamespaceStack
- Direct Known Subclasses:
XMLOutputter.NamespaceStack
class NamespaceStack
extends java.lang.Object
A non-public utility class used by
XMLOutputter
to manage namespaces in a JDOM Document during output.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjava.lang.String
getURI
(java.lang.String prefix) Given a prefix, this will return the namespace URI most rencently (topmost) associated with that prefix.java.lang.String
pop()
This will remove the topmost (most recently added)
, and return its prefix.Namespace
void
push
(org.jdom.Namespace ns) This will add a new
to those currently available.Namespace
int
size()
This returns the number of available namespaces.java.lang.String
toString()
This will print out the size and current stack, from the most recently added
to the "oldest," all toNamespace
System.out
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
prefixes
private java.util.Stack<java.lang.String> prefixesThe prefixes available -
uris
private java.util.Stack<java.lang.String> urisThe 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
to those currently available.Namespace
- Parameters:
ns
-Namespace
to add.
-
pop
public java.lang.String pop()This will remove the topmost (most recently added)
, and return its prefix.Namespace
- 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 java.lang.String getURI(java.lang.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 java.lang.String toString()This will print out the size and current stack, from the most recently added
to the "oldest," all toNamespace
System.out
.- Overrides:
toString
in classjava.lang.Object
-