com.jamesmurty.utils
Class NamespaceContextImpl
java.lang.Object
com.jamesmurty.utils.NamespaceContextImpl
- All Implemented Interfaces:
- NamespaceContext
public class NamespaceContextImpl
- extends Object
- implements NamespaceContext
Mappings between prefix strings and namespace URI strings, as required to
perform XPath queries on namespaced XML documents.
- Author:
- jmurty
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
element
protected Element element
prefixToNsUriMap
protected Map<String,String> prefixToNsUriMap
nsUriToPrefixesMap
protected Map<String,Set<String>> nsUriToPrefixesMap
NamespaceContextImpl
public NamespaceContextImpl()
- Create an empty namespace context.
NamespaceContextImpl
public NamespaceContextImpl(Element element)
- Create a namespace context that will lookup namespace
information in the given element.
addNamespace
public void addNamespace(String prefix,
String namespaceURI)
- Add a custom mapping from prefix to a namespace. This mapping will
override any mappings present in this class's XML Element (if provided).
- Parameters:
prefix - the namespace's prefix. Use an empty string for the
default prefix.namespaceURI - the namespace URI to map.
getNamespaceURI
public String getNamespaceURI(String prefix)
- Specified by:
getNamespaceURI in interface NamespaceContext
getPrefix
public String getPrefix(String namespaceURI)
- Specified by:
getPrefix in interface NamespaceContext
getPrefixes
public Iterator getPrefixes(String namespaceURI)
- Specified by:
getPrefixes in interface NamespaceContext
Copyright © 2013. All Rights Reserved.