TUM CCSM Commons

edu.tum.cs.commons.xml
Class ConstantNamespaceContext

java.lang.Object
  extended by edu.tum.cs.commons.xml.ConstantNamespaceContext
All Implemented Interfaces:
javax.xml.namespace.NamespaceContext

public class ConstantNamespaceContext
extends java.lang.Object
implements javax.xml.namespace.NamespaceContext

A minimalistic implementation of 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.

Version:
$Rev: 26283 $
Author:
deissenb, $Author: juergens $
Rating:
GREEN Hash: E9195A8DBCE2646387CB5388F9C332D6

Constructor Summary
ConstantNamespaceContext(java.lang.String namesspaceURI)
          Create new context.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantNamespaceContext

public ConstantNamespaceContext(java.lang.String namesspaceURI)
Create new context.

Method Detail

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
Always returns the string provided to the constructor.

Specified by:
getNamespaceURI in interface javax.xml.namespace.NamespaceContext

getPrefix

public java.lang.String getPrefix(java.lang.String uri)
Throws UnsupportedOperationException. This method isn't necessary for XPath processing.

Specified by:
getPrefix in interface javax.xml.namespace.NamespaceContext

getPrefixes

public java.util.Iterator getPrefixes(java.lang.String uri)
Throws UnsupportedOperationException. This method isn't necessary for XPath processing.

Specified by:
getPrefixes in interface javax.xml.namespace.NamespaceContext

TUM CCSM Commons

TUM CCSM Commons - 2.7