Package net.sf.okapi.common
Class NSContextManager
- java.lang.Object
-
- net.sf.okapi.common.NSContextManager
-
- All Implemented Interfaces:
NamespaceContext
public class NSContextManager extends Object implements NamespaceContext
Helper class to manage XML namespaces. The reservedxmlandxmlnsprefixes are hard-coded.The following namespaces are pre-defined:
- xml : http://www.w3.org/XML/1998/namespace
- xmlns : http://www.w3.org/2000/xmlns/
- xsl : http://www.w3.org/1999/XSL/Transform
-
-
Constructor Summary
Constructors Constructor Description NSContextManager()Creates a new NSContextManager object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(String prefix, String uri)Adds a prefix/uri pair to the manager.StringgetNamespaceURI(String prefix)Gets the namespace URI for a given prefix.StringgetPrefix(String uri)Gets the prefix for a given namespace URI.Iterator<String>getPrefixes(String uri)Not implemented.
-
-
-
Method Detail
-
getNamespaceURI
public String getNamespaceURI(String prefix)
Gets the namespace URI for a given prefix.- Specified by:
getNamespaceURIin interfaceNamespaceContext- Parameters:
prefix- The prefix to look up.- Returns:
- The namespace URI for the given prefix, or XMLConstants.NULL_NS_URI if none was found.
-
getPrefix
public String getPrefix(String uri)
Gets the prefix for a given namespace URI.- Specified by:
getPrefixin interfaceNamespaceContext- Parameters:
uri- The namespace URI to look up.- Returns:
- The prefix for the given namespace URI, or null the mamager has no such namespace URI defined.
-
getPrefixes
public Iterator<String> getPrefixes(String uri)
Not implemented.- Specified by:
getPrefixesin interfaceNamespaceContext- Returns:
- Always null.
-
-