Esempio n. 1
0
 void declare(Namespace n) {
   if (map.get(n.prefix) == null) {
     map.put(n.prefix, n.uri);
   }
   //    TODO    I think this is analogous to the other way, but have not really thought it
   // through ... should local scope
   //            matter more than outer scope?
   if (uriToPrefix.get(n.uri) == null) {
     uriToPrefix.put(n.uri, n.prefix);
   }
 }
Esempio n. 2
0
 Namespace[] getNamespaces() {
   Iterator i = map.keySet().iterator();
   ArrayList rv = new ArrayList();
   while (i.hasNext()) {
     String prefix = (String) i.next();
     String uri = (String) map.get(prefix);
     Namespace n = Namespace.create(prefix, uri);
     if (!n.isEmpty()) {
       rv.add(n);
     }
   }
   return (Namespace[]) rv.toArray(new Namespace[0]);
 }
Esempio n. 3
0
 Namespace getNamespace(String prefix) {
   if (map.get(prefix) == null) return null;
   return Namespace.create(prefix, (String) map.get(prefix));
 }
Esempio n. 4
0
 Namespace getNamespaceByUri(String uri) {
   if (uriToPrefix.get(uri) == null) return null;
   return Namespace.create(uri, (String) uriToPrefix.get(uri));
 }