@ThreadSafe public class SimpleNamespaceContext extends Object implements NamespaceContext
NamespaceContext
based on a map from prefix values to corresponding URIs. This
implementation only supports a single mapping for a given prefix, that is getPrefixes(String)
will always
contain at most 1 element.Modifier and Type | Field and Description |
---|---|
private com.google.common.collect.ImmutableBiMap<String,String> |
mappings
Mappings between namespace prefixes and namespace URIs.
|
Constructor and Description |
---|
SimpleNamespaceContext()
Constructor.
|
SimpleNamespaceContext(Map<String,String> prefixToUriMappings)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private com.google.common.collect.ImmutableBiMap.Builder<String,String> |
getMappingsBuilder()
Build the initial set of mappings which contains entries for XML and XMLNS.
|
String |
getNamespaceURI(String prefix) |
String |
getPrefix(String namespaceURI) |
Iterator<String> |
getPrefixes(String namespaceURI) |
public SimpleNamespaceContext()
public SimpleNamespaceContext(@Nullable @NullableElements Map<String,String> prefixToUriMappings)
prefixToUriMappings
- Maps prefix values to the corresponding namespace URIs.@Nullable public String getNamespaceURI(@Nonnull String prefix)
getNamespaceURI
in interface NamespaceContext
@Nullable public String getPrefix(@Nonnull String namespaceURI)
getPrefix
in interface NamespaceContext
@Nonnull public Iterator<String> getPrefixes(String namespaceURI)
getPrefixes
in interface NamespaceContext
Copyright © 1999–2018. All rights reserved.