public class NamespaceStack extends Object
QName
)
which are in scope. This is useful when building or navigating a dom4j
document.Modifier and Type | Field and Description |
---|---|
private Map |
currentNamespaceCache
A cache of current namespace context cache of mapping from qualifiedName to QName
|
private Namespace |
defaultNamespace
Caches the default namespace defined via xmlns=""
|
private DocumentFactory |
documentFactory
The factory used to create new
Namespace instances |
private ArrayList |
namespaceCacheList
The cache of qualifiedNames to QNames per namespace context
|
private ArrayList |
namespaceStack
The Stack of namespaces
|
private Map |
rootNamespaceCache
A cache of mapping from qualifiedName to QName before any namespaces are declared
|
Constructor and Description |
---|
NamespaceStack() |
NamespaceStack(DocumentFactory documentFactory) |
Modifier and Type | Method and Description |
---|---|
Namespace |
addNamespace(String prefix,
String uri)
Adds a new namespace to the stack
|
void |
clear()
Clears the stack
|
boolean |
contains(Namespace namespace) |
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 |
findDefaultNamespace()
Attempts to find the current default namespace on the stack right now or returns null if one
could not be found
|
QName |
getAttributeQName(String namespaceURI,
String localName,
String qualifiedName) |
Namespace |
getDefaultNamespace() |
DocumentFactory |
getDocumentFactory() |
Namespace |
getNamespace(int index) |
protected Map |
getNamespaceCache() |
Namespace |
getNamespaceForPrefix(String prefix) |
QName |
getQName(String namespaceURI,
String localName,
String qualifiedName) |
String |
getURI(String prefix) |
Namespace |
pop()
Pops the most recently used
Namespace from
the stack |
Namespace |
pop(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(String prefix,
String uri)
Adds a namepace to the stack with the given prefix and URI
|
protected QName |
pushQName(String localName,
String qualifiedName,
Namespace namespace,
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() |
String |
toString() |
private DocumentFactory documentFactory
Namespace
instancesprivate ArrayList namespaceStack
private ArrayList namespaceCacheList
private Map currentNamespaceCache
private Map rootNamespaceCache
private Namespace defaultNamespace
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)
public Namespace getNamespaceForPrefix(String prefix)
public String getURI(String prefix)
public boolean contains(Namespace namespace)
public QName getAttributeQName(String namespaceURI, String localName, String qualifiedName)
public void push(String prefix, String uri)
public Namespace addNamespace(String prefix, String uri)
public Namespace pop(String prefix)
public DocumentFactory getDocumentFactory()
public void setDocumentFactory(DocumentFactory documentFactory)
public Namespace getDefaultNamespace()
protected QName pushQName(String localName, String qualifiedName, Namespace namespace, String prefix)
protected QName createQName(String localName, String qualifiedName, Namespace namespace)
protected Namespace createNamespace(String prefix, String namespaceURI)
protected Namespace findDefaultNamespace()
protected Map getNamespaceCache()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses