Package de.aristaflow.adept2.util.xml
Class NamespaceLookup
- java.lang.Object
-
- de.aristaflow.adept2.util.xml.NamespaceLookup
-
- All Implemented Interfaces:
NamespaceContext
public class NamespaceLookup extends Object implements NamespaceContext
A resolver looking up the namespace in a map of provided namespaces and in a specificDocument.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDEFAULT_VALUEThe default value returned in case the map does not contain a key.protected ConcurrentMap<String,String>ns2PrefAdditional prefixes in a map indexed by the corresponding namespace.protected ConcurrentMap<String,String>pref2NsAdditional namespaces in a map indexed by the corresponding prefix.protected DocumentsourceDocumentThe document in which to lookup the namespace.
-
Constructor Summary
Constructors Constructor Description NamespaceLookup(Document document)Creates a newNamespaceContextlooking up namespaces in the designatedDocumentor additionally set namespaces.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddNamespace(String prefix, String namespace)Adds the designated prefix and namespace additionally to the document.StringgetNamespaceURI(String prefix)StringgetPrefix(String namespaceURI)IteratorgetPrefixes(String namespaceURI)
-
-
-
Field Detail
-
DEFAULT_VALUE
protected static final String DEFAULT_VALUE
The default value returned in case the map does not contain a key.- See Also:
- Constant Field Values
-
pref2Ns
protected final ConcurrentMap<String,String> pref2Ns
Additional namespaces in a map indexed by the corresponding prefix. This takes precedence oversourceDocument.
-
ns2Pref
protected final ConcurrentMap<String,String> ns2Pref
Additional prefixes in a map indexed by the corresponding namespace. This is the reverse mapping ofpref2Ns. It takes precedence oversourceDocument.
-
sourceDocument
protected final Document sourceDocument
The document in which to lookup the namespace.
-
-
Constructor Detail
-
NamespaceLookup
public NamespaceLookup(Document document)
Creates a newNamespaceContextlooking up namespaces in the designatedDocumentor additionally set namespaces.- Parameters:
document- The document in which to lookup the namespace.
-
-
Method Detail
-
addNamespace
public void addNamespace(String prefix, String namespace)
Adds the designated prefix and namespace additionally to the document. This takes precedence over the document.- Parameters:
prefix- The prefix which to additionally add.namespace- The namespace which to additionally add.
-
getNamespaceURI
public String getNamespaceURI(String prefix)
- Specified by:
getNamespaceURIin interfaceNamespaceContext
-
getPrefix
public String getPrefix(String namespaceURI)
- Specified by:
getPrefixin interfaceNamespaceContext
-
getPrefixes
public Iterator getPrefixes(String namespaceURI)
- Specified by:
getPrefixesin interfaceNamespaceContext
-
-