|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jaxen.SimpleNamespaceContext
public class SimpleNamespaceContext
Provides mappings from namespace prefix to namespace URI to the XPath engine.
Field Summary | |
---|---|
private java.util.Map |
namespaces
|
private static long |
serialVersionUID
|
Constructor Summary | |
---|---|
SimpleNamespaceContext()
Creates a new empty namespace context. |
|
SimpleNamespaceContext(java.util.Map namespaces)
Creates a new namespace context pre-populated with the specified bindings. |
Method Summary | |
---|---|
void |
addElementNamespaces(Navigator nav,
java.lang.Object element)
Adds all the namespace declarations that are in scope on the given element. |
void |
addNamespace(java.lang.String prefix,
java.lang.String URI)
Binds a prefix to a URI in this context. |
java.lang.String |
translateNamespacePrefixToUri(java.lang.String prefix)
Translate the provided namespace prefix into the matching bound namespace URI. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private java.util.Map namespaces
Constructor Detail |
---|
public SimpleNamespaceContext()
public SimpleNamespaceContext(java.util.Map namespaces)
namespaces
- the initial namespace bindings in scope. The keys in this
must be strings containing the prefixes and the values are strings
containing the namespace URIs.
java.lang.NullPointerException
- if the argument is null
java.lang.ClassCastException
- if any keys or values in the map are not stringsMethod Detail |
---|
public void addElementNamespaces(Navigator nav, java.lang.Object element) throws UnsupportedAxisException
<xsl:if test="condition/xpath/expression">
.
nav
- the navigator for use in conjunction with
element
element
- the element to copy the namespaces from
UnsupportedAxisException
- if the navigator does not support the
namespace axispublic void addNamespace(java.lang.String prefix, java.lang.String URI)
prefix
- the namespace prefixURI
- the namespace URIpublic java.lang.String translateNamespacePrefixToUri(java.lang.String prefix)
NamespaceContext
In XPath, there is no such thing as a 'default namespace'. The empty prefix always resolves to the empty namespace URI. This method should return null for the empty prefix. Similarly, the prefix "xml" always resolves to the URI "http://www.w3.org/XML/1998/namespace".
translateNamespacePrefixToUri
in interface NamespaceContext
prefix
- the namespace prefix to resolve
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |