|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.cocoon.stax.converter.util.SimpleNamespaceContext
public class SimpleNamespaceContext
Simple NamespaceContext implementation backed by a HashMap.
| Field Summary | |
|---|---|
protected Map<String,String> |
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(Map<String,String> 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,
Map<String,String> namespaces)
Constructs an empty SimpleNamespaceContext with the given parent. |
|
| Method Summary | |
|---|---|
int |
getDeclaredPrefixCount()
Returns the number of namespace prefixes declared in this context. |
Iterator<String> |
getDeclaredPrefixes()
Returns an Iterator of all namespace prefixes declared within this context,
irrespective of any ancestor contexts. |
String |
getNamespaceURI(String prefix)
|
NamespaceContext |
getParent()
Returns a reference to the parent of this context. |
String |
getPrefix(String nsURI)
|
Iterator<String> |
getPrefixes()
Returns an Iterator of all namespace prefixes in scope within this context, including
those inherited from ancestor contexts. |
Iterator<String> |
getPrefixes(String nsURI)
|
boolean |
isPrefixDeclared(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. |
String |
setDefaultNamespace(String nsURI)
Sets the default namespace in this context. |
void |
setParent(NamespaceContext parent)
Sets the parent context used to inherit namespace bindings. |
String |
setPrefix(String prefix,
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 Map<String,String> namespaces
getPrefix(String) always returns the same prefix, unless that prefix is
removed.
| Constructor Detail |
|---|
public SimpleNamespaceContext()
public SimpleNamespaceContext(Map<String,String> namespaces)
namespaces - A Map of namespace URIs, keyed by their prefixes.public SimpleNamespaceContext(NamespaceContext parent)
parent - The parent context.
public SimpleNamespaceContext(NamespaceContext parent,
Map<String,String> namespaces)
parent - The parent context.namespaces - A Map of namespace URIs, keyed by their prefixes.| Method Detail |
|---|
public NamespaceContext getParent()
getParent in interface ExtendedNamespaceContextnull 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 String getNamespaceURI(String prefix)
getNamespaceURI in interface NamespaceContextpublic String getPrefix(String nsURI)
getPrefix in interface NamespaceContextpublic boolean isPrefixDeclared(String prefix)
isPrefixDeclared in interface ExtendedNamespaceContextprefix - The prefix to check.
true if the prefix is declared in this context, false
otherwise.public Iterator<String> getDeclaredPrefixes()
ExtendedNamespaceContextIterator of all namespace prefixes declared within this context,
irrespective of any ancestor contexts.
getDeclaredPrefixes in interface ExtendedNamespaceContextIterator of prefix Strings.public int getDeclaredPrefixCount()
public Iterator<String> getPrefixes()
ExtendedNamespaceContextIterator of all namespace prefixes in scope within this context, including
those inherited from ancestor contexts.
getPrefixes in interface ExtendedNamespaceContextIterator of prefix Strings.public Iterator<String> getPrefixes(String nsURI)
getPrefixes in interface NamespaceContextpublic String setDefaultNamespace(String nsURI)
nsURI - The default namespace URI.
null if the default prefix
wasn't previously declared in this context.
public String setPrefix(String prefix,
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 | |||||||||