TUM CCSM Commons

edu.tum.cs.commons.xml
Class ConstantNamespaceContext

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

public class ConstantNamespaceContext
extends Object
implements 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(String namesspaceURI)
          Create new context.
 
Method Summary
 String getNamespaceURI(String prefix)
          Always returns the string provided to the constructor.
 String getPrefix(String uri)
          Throws UnsupportedOperationException.
 Iterator getPrefixes(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(String namesspaceURI)
Create new context.

Method Detail

getNamespaceURI

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

Specified by:
getNamespaceURI in interface NamespaceContext

getPrefix

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

Specified by:
getPrefix in interface NamespaceContext

getPrefixes

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

Specified by:
getPrefixes in interface NamespaceContext

TUM CCSM Commons

TUM CCSM Commons - 2.7