public class NamespaceStack
extends java.lang.Object
QName
) which are in
scope. This is useful when building or navigating a dom4j document.Constructor and Description |
---|
NamespaceStack() |
NamespaceStack(DocumentFactory documentFactory) |
Modifier and Type | Method and Description |
---|---|
Namespace |
addNamespace(java.lang.String prefix,
java.lang.String uri)
Adds a new namespace to the stack
|
void |
clear()
Clears the stack
|
boolean |
contains(Namespace namespace)
DOCUMENT ME!
|
protected Namespace |
createNamespace(java.lang.String prefix,
java.lang.String namespaceURI)
Factory method to creeate new Namespace instances.
|
protected QName |
createQName(java.lang.String localName,
java.lang.String qualifiedName,
Namespace namespace)
Factory method to creeate new QName instances.
|
protected Namespace |
findDefaultNamespace()
Attempts to find the current default namespace on the stack right now or
returns null if one could not be found
|
QName |
getAttributeQName(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName) |
Namespace |
getDefaultNamespace() |
DocumentFactory |
getDocumentFactory() |
Namespace |
getNamespace(int index)
DOCUMENT ME!
|
protected java.util.Map<java.lang.String,QName> |
getNamespaceCache() |
Namespace |
getNamespaceForPrefix(java.lang.String prefix)
DOCUMENT ME!
|
QName |
getQName(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qualifiedName) |
java.lang.String |
getURI(java.lang.String prefix)
DOCUMENT ME!
|
Namespace |
pop()
Pops the most recently used
Namespace from the stack |
Namespace |
pop(java.lang.String prefix)
Pops a namepace from the stack with the given prefix and URI
|
void |
push(Namespace namespace)
Pushes the given namespace onto the stack so that its prefix becomes
available.
|
void |
push(java.lang.String prefix,
java.lang.String uri)
Adds a namepace to the stack with the given prefix and URI
|
protected QName |
pushQName(java.lang.String localName,
java.lang.String qualifiedName,
Namespace namespace,
java.lang.String prefix)
Adds the QName to the stack of available QNames
|
protected Namespace |
remove(int index)
Removes the namespace at the given index of the stack
|
void |
setDocumentFactory(DocumentFactory documentFactory) |
int |
size()
DOCUMENT ME!
|
java.lang.String |
toString() |
public NamespaceStack()
public NamespaceStack(DocumentFactory documentFactory)
public void push(Namespace namespace)
namespace
- is the Namespace
to add to the stack.public Namespace pop()
Namespace
from the stackpublic int size()
public void clear()
public Namespace getNamespace(int index)
index
- DOCUMENT ME!public Namespace getNamespaceForPrefix(java.lang.String prefix)
prefix
- DOCUMENT ME!public java.lang.String getURI(java.lang.String prefix)
prefix
- DOCUMENT ME!public boolean contains(Namespace namespace)
namespace
- DOCUMENT ME!public QName getQName(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName)
public QName getAttributeQName(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qualifiedName)
public void push(java.lang.String prefix, java.lang.String uri)
prefix
- DOCUMENT ME!uri
- DOCUMENT ME!public Namespace addNamespace(java.lang.String prefix, java.lang.String uri)
prefix
- DOCUMENT ME!uri
- DOCUMENT ME!public Namespace pop(java.lang.String prefix)
prefix
- DOCUMENT ME!public java.lang.String toString()
toString
in class java.lang.Object
public DocumentFactory getDocumentFactory()
public void setDocumentFactory(DocumentFactory documentFactory)
public Namespace getDefaultNamespace()
protected QName pushQName(java.lang.String localName, java.lang.String qualifiedName, Namespace namespace, java.lang.String prefix)
localName
- DOCUMENT ME!qualifiedName
- DOCUMENT ME!namespace
- DOCUMENT ME!prefix
- DOCUMENT ME!protected QName createQName(java.lang.String localName, java.lang.String qualifiedName, Namespace namespace)
localName
- DOCUMENT ME!qualifiedName
- DOCUMENT ME!namespace
- DOCUMENT ME!protected Namespace createNamespace(java.lang.String prefix, java.lang.String namespaceURI)
prefix
- DOCUMENT ME!namespaceURI
- DOCUMENT ME!protected Namespace findDefaultNamespace()
protected Namespace remove(int index)
index
- DOCUMENT ME!protected java.util.Map<java.lang.String,QName> getNamespaceCache()