|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavanet.staxutils.SimpleNamespaceContext
public class SimpleNamespaceContext
Simple NamespaceContext implementation backed by a HashMap.
Field Summary | |
---|---|
protected java.util.Map |
namespaces
map containing bound namespaces, keyed by their prefix. |
protected NamespaceContext |
parent
The parent context, which may be null |
Constructor Summary | |
---|---|
SimpleNamespaceContext()
Constructs a SimpleNamespaceContext with no parent context or namespace declarations. |
|
SimpleNamespaceContext(java.util.Map namespaces)
Constructs a SimpleNamespaceContext with no parent context that contains the specified prefixes. |
|
SimpleNamespaceContext(NamespaceContext parent)
Constructs an empty SimpleNamespaceContext with the given parent. |
|
SimpleNamespaceContext(NamespaceContext parent,
java.util.Map namespaces)
Constructs an empty SimpleNamespaceContext with the given parent. |
Method Summary | |
---|---|
int |
getDeclaredPrefixCount()
Returns the number of namespace prefixes declared in this context. |
java.util.Iterator |
getDeclaredPrefixes()
Returns an Iterator of all namespace prefixes declared within
this context, irrespective of any ancestor contexts. |
java.lang.String |
getNamespaceURI(java.lang.String prefix)
|
NamespaceContext |
getParent()
Returns a reference to the parent of this context. |
java.lang.String |
getPrefix(java.lang.String nsURI)
|
java.util.Iterator |
getPrefixes()
Returns an Iterator of all namespace prefixes in scope within this
context, including those inherited from ancestor contexts. |
java.util.Iterator |
getPrefixes(java.lang.String nsURI)
|
boolean |
isPrefixDeclared(java.lang.String prefix)
Determines if the specified prefix is declared within this context, irrespective of any ancestor contexts. |
boolean |
isRootContext()
Determines if this is a root context. |
java.lang.String |
setDefaultNamespace(java.lang.String nsURI)
Sets the default namespace in this context. |
void |
setParent(NamespaceContext parent)
Sets the parent context used to inherit namespace bindings. |
java.lang.String |
setPrefix(java.lang.String prefix,
java.lang.String nsURI)
Declares a namespace binding in this context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected NamespaceContext parent
null
protected java.util.Map namespaces
getPrefix(String)
always returns the same
prefix, unless that prefix is removed.
Constructor Detail |
---|
public SimpleNamespaceContext()
public SimpleNamespaceContext(java.util.Map namespaces)
namespaces
- A Map of namespace URIs, keyed by their prefixes.public SimpleNamespaceContext(NamespaceContext parent)
parent
- The parent context.public SimpleNamespaceContext(NamespaceContext parent, java.util.Map namespaces)
parent
- The parent context.namespaces
- A Map of namespace URIs, keyed by their prefixes.Method Detail |
---|
public NamespaceContext getParent()
getParent
in interface ExtendedNamespaceContext
null
if this is a root
context.public void setParent(NamespaceContext parent)
parent
- The new parent context.public boolean isRootContext()
true
if this is a root context, false
otherwise.public java.lang.String getNamespaceURI(java.lang.String prefix)
getNamespaceURI
in interface NamespaceContext
public java.lang.String getPrefix(java.lang.String nsURI)
getPrefix
in interface NamespaceContext
public boolean isPrefixDeclared(java.lang.String prefix)
isPrefixDeclared
in interface ExtendedNamespaceContext
prefix
- The prefix to check.
true
if the prefix is declared in this context,
false
otherwise.public java.util.Iterator getDeclaredPrefixes()
ExtendedNamespaceContext
Iterator
of all namespace prefixes declared within
this context, irrespective of any ancestor contexts.
getDeclaredPrefixes
in interface ExtendedNamespaceContext
Iterator
of prefix String
s.public int getDeclaredPrefixCount()
public java.util.Iterator getPrefixes()
ExtendedNamespaceContext
Iterator
of all namespace prefixes in scope within this
context, including those inherited from ancestor contexts.
getPrefixes
in interface ExtendedNamespaceContext
Iterator
of prefix String
s.public java.util.Iterator getPrefixes(java.lang.String nsURI)
getPrefixes
in interface NamespaceContext
public java.lang.String setDefaultNamespace(java.lang.String nsURI)
nsURI
- The default namespace URI.
null
if
the default prefix wasn't previously declared in this context.public java.lang.String setPrefix(java.lang.String prefix, java.lang.String nsURI)
prefix
- The namespace prefix.nsURI
- The namespace URI.
null
if
the prefix wasn't previously declared in this context.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |