1 20 21 27 28 package com.sun.org.apache.xerces.internal.util; 29 30 import java.util.Enumeration ; 31 import java.util.Vector ; 32 import javax.xml.namespace.NamespaceContext ; 33 34 48 public class NamespaceContextWrapper implements NamespaceContext { 49 50 private com.sun.org.apache.xerces.internal.xni.NamespaceContext fNamespaceContext; 51 52 public NamespaceContextWrapper(NamespaceSupport namespaceContext) { 53 fNamespaceContext = namespaceContext ; 54 } 55 56 public String getNamespaceURI(String prefix) { 57 if (prefix == null) { 58 throw new IllegalArgumentException ("Prefix can't be null"); 59 } 60 return fNamespaceContext.getURI(prefix.intern()); 61 } 62 63 public String getPrefix(String namespaceURI) { 64 if (namespaceURI == null || namespaceURI.trim().length() == 0) { 65 throw new IllegalArgumentException ("URI can't be null or empty String"); 66 } 67 return fNamespaceContext.getPrefix(namespaceURI.intern()); 68 } 69 70 74 public java.util.Iterator getPrefixes(String namespaceURI) { 75 if (namespaceURI == null || namespaceURI.trim().length() == 0) { 76 throw new IllegalArgumentException ("URI can't be null or empty String"); 77 } 78 else { 79 Vector vector = 80 ((NamespaceSupport) fNamespaceContext).getPrefixes(namespaceURI.intern()); 81 return vector.iterator(); 82 } 83 } 84 85 88 public com.sun.org.apache.xerces.internal.xni.NamespaceContext getNamespaceContext() { 89 return fNamespaceContext; 90 } 91 92 } 93 | Popular Tags |