public class ConstantNamespaceContext extends java.lang.Object implements javax.xml.namespace.NamespaceContext
NamespaceContext to be used with
XPath. Method getNamespaceURI(String) always returns the
string provided to the constructor. All other methods throw
UnsupportedOperationExceptions. These methods are not needed for
XPath resolution.
Implementation is inspired by snippet on http://www.ibm.com/developerworks/library/x-javaxpathapi.html.
| Constructor and Description |
|---|
ConstantNamespaceContext(java.lang.String namesspaceURI)
Create new context.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Always returns the string provided to the constructor.
|
java.lang.String |
getPrefix(java.lang.String uri)
Throws
UnsupportedOperationException. |
java.util.Iterator |
getPrefixes(java.lang.String uri)
Throws
UnsupportedOperationException. |
public ConstantNamespaceContext(java.lang.String namesspaceURI)
public java.lang.String getNamespaceURI(java.lang.String prefix)
getNamespaceURI in interface javax.xml.namespace.NamespaceContextpublic java.lang.String getPrefix(java.lang.String uri)
UnsupportedOperationException. This method isn't necessary
for XPath processing.getPrefix in interface javax.xml.namespace.NamespaceContextpublic java.util.Iterator getPrefixes(java.lang.String uri)
UnsupportedOperationException. This method isn't necessary
for XPath processing.getPrefixes in interface javax.xml.namespace.NamespaceContext