for keeping track of prefix to URI mapping
implements the NamespaceContext necessary for XPath evaluation
Field Summary |
private int |
genNumber
|
private java.util.Map<java.lang.String,java.lang.String> |
nsMap
|
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 |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
nsMap
private java.util.Map<java.lang.String,java.lang.String> nsMap
genNumber
private int genNumber
NamespaceContext
public NamespaceContext()
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
-
getAllPrefixesURI
public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.String>> getAllPrefixesURI()
- Return the set of all prefixes
- Returns:
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:
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:
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)