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 NamespaceCaches the default namespace defined via xmlns=""private DocumentFactoryThe factory used to create newNamespaceinstancesThe 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 stackvoidclear()Clears the stackbooleanDOCUMENT ME!protected NamespacecreateNamespace(String prefix, String namespaceURI) Factory method to creeate new Namespace instances.protected QNamecreateQName(String localName, String qualifiedName, Namespace namespace) Factory method to creeate new QName instances.protected NamespaceAttempts 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 usedNamespacefrom the stackPops a namepace from the stack with the given prefix and URIvoidAdds a namepace to the stack with the given prefix and URIvoidPushes the given namespace onto the stack so that its prefix becomes available.protected QNameAdds the QName to the stack of available QNamesprotected Namespaceremove(int index) Removes the namespace at the given index of the stackvoidsetDocumentFactory(DocumentFactory documentFactory) intsize()DOCUMENT ME!toString()
-
Field Details
-
documentFactory
The factory used to create newNamespaceinstances -
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 theNamespaceto add to the stack.
-
pop
Pops the most recently usedNamespacefrom 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
-