< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/util/NamespaceContextWrapper.java

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.org.apache.xerces.internal.util;
  27 
  28 import java.util.Iterator;
  29 import java.util.List;
  30 import javax.xml.namespace.NamespaceContext;
  31 
  32 /**
  33  * Writing a wrapper to re-use most of the namespace functionality
  34  * already provided by NamespaceSupport, which implements NamespaceContext
  35  * from XNI. It would be good if we can change the XNI NamespaceContext
  36  * interface to implement the JAXP NamespaceContext interface.
  37  *
  38  * Note that NamespaceSupport assumes the use of symbols. Since this class
  39  * can be exposed to the application, we must intern all Strings before
  40  * calling NamespaceSupport methods.
  41  *
  42  * @author  Neeraj Bajaj, Sun Microsystems, inc.
  43  * @author Santiago.PericasGeertsen@sun.com
  44  *
  45  */
  46 public class NamespaceContextWrapper implements NamespaceContext {
  47 
  48     private com.sun.org.apache.xerces.internal.xni.NamespaceContext fNamespaceContext;
  49 
  50     public NamespaceContextWrapper(NamespaceSupport namespaceContext) {
  51         fNamespaceContext = namespaceContext ;
  52     }
  53 
  54     public String getNamespaceURI(String prefix) {
  55         if (prefix == null) {
  56             throw new IllegalArgumentException("Prefix can't be null");
  57         }
  58         return fNamespaceContext.getURI(prefix.intern());
  59     }
  60 
  61     public String getPrefix(String namespaceURI) {
  62         if (namespaceURI == null) {
  63             throw new IllegalArgumentException("URI can't be null.");




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.org.apache.xerces.internal.util;
  27 
  28 import java.util.Iterator;
  29 import java.util.List;
  30 import javax.xml.namespace.NamespaceContext;
  31 
  32 /**
  33  * Writing a wrapper to re-use most of the namespace functionality
  34  * already provided by NamespaceSupport, which implements NamespaceContext
  35  * from XNI. It would be good if we can change the XNI NamespaceContext
  36  * interface to implement the JAXP NamespaceContext interface.
  37  *
  38  * Note that NamespaceSupport assumes the use of symbols. Since this class
  39  * can be exposed to the application, we must intern all Strings before
  40  * calling NamespaceSupport methods.
  41  *
  42  * @author  Neeraj Bajaj 
  43  * @author Santiago PericasGeertsen
  44  *
  45  */
  46 public class NamespaceContextWrapper implements NamespaceContext {
  47 
  48     private com.sun.org.apache.xerces.internal.xni.NamespaceContext fNamespaceContext;
  49 
  50     public NamespaceContextWrapper(NamespaceSupport namespaceContext) {
  51         fNamespaceContext = namespaceContext ;
  52     }
  53 
  54     public String getNamespaceURI(String prefix) {
  55         if (prefix == null) {
  56             throw new IllegalArgumentException("Prefix can't be null");
  57         }
  58         return fNamespaceContext.getURI(prefix.intern());
  59     }
  60 
  61     public String getPrefix(String namespaceURI) {
  62         if (namespaceURI == null) {
  63             throw new IllegalArgumentException("URI can't be null.");


< prev index next >