public class ScopedNamespaceContext extends AbstractNamespaceContext
NamespaceContext implementation that supports nested scopes. A scope is typically
associated with a start tag / end tag pair. The implementation takes care of correctly
handling masked namespace bindings. Masking occurs when the same prefix is bound to a different
namespace URI in a nested scope.| Modifier and Type | Field and Description |
|---|---|
(package private) int |
bindings
The number of currently defined namespace bindings.
|
(package private) java.lang.String[] |
prefixArray
Array containing the prefixes for the namespace bindings.
|
private int[] |
scopeIndexes
Tracks the scopes defined for this namespace context.
|
private int |
scopes
The number of currently defined scopes.
|
(package private) java.lang.String[] |
uriArray
Array containing the URIs for the namespace bindings.
|
| Constructor and Description |
|---|
ScopedNamespaceContext() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
doGetNamespaceURI(java.lang.String prefix)
Get namespace URI bound to a prefix in the current scope.
|
protected java.lang.String |
doGetPrefix(java.lang.String namespaceURI)
Get prefix bound to namespace URI in the current scope.
|
protected java.util.Iterator |
doGetPrefixes(java.lang.String namespaceURI)
Get all prefixes bound to a namespace URI in the current scope.
|
void |
endScope()
End the current scope and restore the scope in which the current scope was nested.
|
void |
setPrefix(java.lang.String prefix,
java.lang.String namespaceURI)
Define a prefix binding in the current scope.
|
void |
startScope()
Start a new scope.
|
getNamespaceURI, getPrefix, getPrefixesjava.lang.String[] prefixArray
java.lang.String[] uriArray
int bindings
private int[] scopeIndexes
prefixArray/uriArray.private int scopes
public void setPrefix(java.lang.String prefix,
java.lang.String namespaceURI)
prefix - the prefix to bind or the empty string to set the default namespace; may not
be nullnamespaceURI - the corresponding namespace URI; may not be nullpublic void startScope()
public void endScope()
startScope() method.protected java.lang.String doGetNamespaceURI(java.lang.String prefix)
AbstractNamespaceContextNamespaceContext.getNamespaceURI(String), except that the
implementation is not required to handle the implicit namespace bindings.doGetNamespaceURI in class AbstractNamespaceContextprefix - prefix to look upprotected java.lang.String doGetPrefix(java.lang.String namespaceURI)
AbstractNamespaceContextNamespaceContext.getPrefix(String),
except that the implementation is not required to handle the implicit
namespace bindings.doGetPrefix in class AbstractNamespaceContextnamespaceURI - URI of namespace to lookupprotected java.util.Iterator doGetPrefixes(java.lang.String namespaceURI)
AbstractNamespaceContextNamespaceContext.getPrefixes(String), except that the
implementation is not required to handle the implicit namespace bindings.doGetPrefixes in class AbstractNamespaceContextnamespaceURI - URI of namespace to lookup