Package org.custommonkey.xmlunit
Class SimpleNamespaceContext
- java.lang.Object
-
- org.custommonkey.xmlunit.SimpleNamespaceContext
-
- All Implemented Interfaces:
NamespaceContext
public class SimpleNamespaceContext extends Object implements NamespaceContext
Implementation of NamespaceContext that's backed by a map.
-
-
Field Summary
Fields Modifier and Type Field Description static SimpleNamespaceContextEMPTY_CONTEXTAn empty context containing no prefixes at all.
-
Constructor Summary
Constructors Constructor Description SimpleNamespaceContext(Map prefixMap)Creates a NamespaceContext backed by the given map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetNamespaceURI(String prefix)Obtain the URI for a given prefix.Iterator<String>getPrefixes()Get all prefixes of this context.
-
-
-
Field Detail
-
EMPTY_CONTEXT
public static final SimpleNamespaceContext EMPTY_CONTEXT
An empty context containing no prefixes at all.
-
-
Constructor Detail
-
SimpleNamespaceContext
public SimpleNamespaceContext(Map prefixMap)
Creates a NamespaceContext backed by the given map.Copies the map, changes made to the given map after calling the constructor are not reflected into the NamespaceContext.
- Parameters:
prefixMap- maps prefix to Namespace URI
-
-
Method Detail
-
getNamespaceURI
public String getNamespaceURI(String prefix)
Description copied from interface:NamespaceContextObtain the URI for a given prefix.Unlike the method in javax.xml.namespace.NamespaceContext doesn't have to implement any special handling for predefined prefix values.
- Specified by:
getNamespaceURIin interfaceNamespaceContext- Parameters:
prefix- prefix to look up- Returns:
- null if the prefix is unknown.
-
getPrefixes
public Iterator<String> getPrefixes()
Description copied from interface:NamespaceContextGet all prefixes of this context.- Specified by:
getPrefixesin interfaceNamespaceContext- Returns:
- all prefixes of this context
-
-