ca.umontreal.iro.rali
Class NamespaceContext

java.lang.Object
  extended by ca.umontreal.iro.rali.NamespaceContext
All Implemented Interfaces:
javax.xml.namespace.NamespaceContext

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

Encapsulates a Map for keeping track of prefix to URI mapping implements the NamespaceContext necessary for XPath evaluation


Constructor Summary
NamespaceContext()
           
 
Method Summary
 void addPrefixURI(java.lang.String prefix, java.lang.String newURI)
          add a new prefix-URI pair (generate a new prefix if it already exists with a different URI)
 java.lang.String genPrefix(java.lang.String namespaceURI)
          assign a new prefix for an URI
 java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getAllPrefixesURI()
          Return the set of all prefixes
 java.lang.String getNamespaceURI(java.lang.String prefix)
          for the interface implementation
 java.lang.String getOrGenPrefix(java.lang.String namespaceURI)
          get the prefix of a URI or assign a new one if it does not exist
 java.lang.String getPrefix(java.lang.String namespaceURI)
          for the interface implementation
 java.util.Iterator<java.lang.String> getPrefixes(java.lang.String namespaceURI)
          for the interface implementation
 void removePrefix(java.lang.String prefix)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamespaceContext

public NamespaceContext()
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addPrefixURI

public void addPrefixURI(java.lang.String prefix,
                         java.lang.String newURI)
add a new prefix-URI pair (generate a new prefix if it already exists with a different URI)

Parameters:
prefix -
newURI -

removePrefix

public void removePrefix(java.lang.String prefix)

getAllPrefixesURI

public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getAllPrefixesURI()
Return the set of all prefixes

Returns:
all prefixes

getNamespaceURI

public java.lang.String getNamespaceURI(java.lang.String prefix)
for the interface implementation

Specified by:
getNamespaceURI in interface javax.xml.namespace.NamespaceContext
See Also:
NamespaceContext.getNamespaceURI(java.lang.String)

getPrefix

public java.lang.String getPrefix(java.lang.String namespaceURI)
for the interface implementation

Specified by:
getPrefix in interface javax.xml.namespace.NamespaceContext
See Also:
NamespaceContext.getPrefix(java.lang.String)

genPrefix

public java.lang.String genPrefix(java.lang.String namespaceURI)
assign a new prefix for an URI

Parameters:
namespaceURI -
Returns:
string version of the new prefix

getOrGenPrefix

public java.lang.String getOrGenPrefix(java.lang.String namespaceURI)
get the prefix of a URI or assign a new one if it does not exist

Parameters:
namespaceURI -
Returns:
string version of the prefix

getPrefixes

public java.util.Iterator<java.lang.String> getPrefixes(java.lang.String namespaceURI)
for the interface implementation

Specified by:
getPrefixes in interface javax.xml.namespace.NamespaceContext
See Also:
NamespaceContext.getPrefixes(java.lang.String)