FileDocCategorySizeDatePackage
NamespaceContextWrapper.javaAPI DocJava SE 6 API3293Tue Jun 10 00:22:52 BST 2008com.sun.org.apache.xerces.internal.util

NamespaceContextWrapper

public class NamespaceContextWrapper extends Object implements NamespaceContext
Writing a wrapper to re-use most of the namespace functionality already provided by NamespaceSupport, which implements NamespaceContext from XNI. It would be good if we can change the XNI NamespaceContext interface to implement the JAXP NamespaceContext interface. Note that NamespaceSupport assumes the use of symbols. Since this class can be exposed to the application, we must intern all Strings before calling NamespaceSupport methods.
author
Neeraj Bajaj, Sun Microsystems, inc.
author
Santiago.PericasGeertsen@sun.com

Fields Summary
private NamespaceContext
fNamespaceContext
Constructors Summary
public NamespaceContextWrapper(NamespaceSupport namespaceContext)

        fNamespaceContext = namespaceContext ;
    
Methods Summary
public com.sun.org.apache.xerces.internal.xni.NamespaceContextgetNamespaceContext()
This method supports all functions in the NamespaceContext utility class

        return fNamespaceContext;
    
public java.lang.StringgetNamespaceURI(java.lang.String prefix)

        if (prefix == null) {
            throw new IllegalArgumentException("Prefix can't be null");
        }
        return fNamespaceContext.getURI(prefix.intern());
    
public java.lang.StringgetPrefix(java.lang.String namespaceURI)

        if (namespaceURI == null || namespaceURI.trim().length() == 0) {
            throw new IllegalArgumentException("URI can't be null or empty String");
        }
        return fNamespaceContext.getPrefix(namespaceURI.intern());
    
public java.util.IteratorgetPrefixes(java.lang.String namespaceURI)
TODO: Namespace doesn't give information giving multiple prefixes for the same namespaceURI.

        if (namespaceURI == null || namespaceURI.trim().length() == 0) {
            throw new IllegalArgumentException("URI can't be null or empty String");
        } 
        else {
            Vector vector = 
                ((NamespaceSupport) fNamespaceContext).getPrefixes(namespaceURI.intern());
            return vector.iterator();
        }