Class NamespaceStack
java.lang.Object
org.dom4j.tree.NamespaceStack
NamespaceStack implements a stack of namespaces and optionally maintains a
cache of all the fully qualified names (
QName
) which are in
scope. This is useful when building or navigating a dom4j document.- Version:
- $Revision: 1.13 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionA cache of current namespace context cache of mapping from qualifiedName to QNameprivate Namespace
Caches the default namespace defined via xmlns=""private DocumentFactory
The factory used to create newNamespace
instancesThe cache of qualifiedNames to QNames per namespace contextThe Stack of namespacesA cache of mapping from qualifiedName to QName before any namespaces are declared -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddNamespace
(String prefix, String uri) Adds a new namespace to the stackvoid
clear()
Clears the stackboolean
DOCUMENT ME!protected Namespace
createNamespace
(String prefix, String namespaceURI) Factory method to creeate new Namespace instances.protected QName
createQName
(String localName, String qualifiedName, Namespace namespace) Factory method to creeate new QName instances.protected Namespace
Attempts to find the current default namespace on the stack right now or returns null if one could not be foundgetAttributeQName
(String namespaceURI, String localName, String qualifiedName) getNamespace
(int index) DOCUMENT ME!getNamespaceForPrefix
(String prefix) DOCUMENT ME!DOCUMENT ME!pop()
Pops the most recently usedNamespace
from the stackPops a namepace from the stack with the given prefix and URIvoid
Adds a namepace to the stack with the given prefix and URIvoid
Pushes the given namespace onto the stack so that its prefix becomes available.protected QName
Adds the QName to the stack of available QNamesprotected Namespace
remove
(int index) Removes the namespace at the given index of the stackvoid
setDocumentFactory
(DocumentFactory documentFactory) int
size()
DOCUMENT ME!toString()
-
Field Details
-
documentFactory
The factory used to create newNamespace
instances -
namespaceStack
-
namespaceCacheList
-
currentNamespaceCache
-
rootNamespaceCache
-
defaultNamespace
Caches the default namespace defined via xmlns=""
-
-
Constructor Details
-
NamespaceStack
public NamespaceStack() -
NamespaceStack
-
-
Method Details
-
push
Pushes the given namespace onto the stack so that its prefix becomes available.- Parameters:
namespace
- is theNamespace
to add to the stack.
-
pop
Pops the most recently usedNamespace
from the stack- Returns:
- Namespace popped from the stack
-
size
public int size()DOCUMENT ME!- Returns:
- the number of namespaces on the stackce stack.
-
clear
public void clear()Clears the stack -
getNamespace
DOCUMENT ME!- Parameters:
index
- DOCUMENT ME!- Returns:
- the namespace at the specified index on the stack
-
getNamespaceForPrefix
-
getURI
-
contains
DOCUMENT ME!- Parameters:
namespace
- DOCUMENT ME!- Returns:
- true if the given prefix is in the stack.
-
getQName
-
getAttributeQName
-
push
-
addNamespace
-
pop
-
toString
-
getDocumentFactory
-
setDocumentFactory
-
getDefaultNamespace
-
pushQName
-
createQName
-
createNamespace
-
findDefaultNamespace
Attempts to find the current default namespace on the stack right now or returns null if one could not be found- Returns:
- DOCUMENT ME!
-
remove
Removes the namespace at the given index of the stack- Parameters:
index
- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
getNamespaceCache
-