Пример #1
0
 /**
  * Recursively finds the uri for the specified prefix.
  *
  * @param pref prefix
  * @return uri
  */
 public final byte[] uri(final byte[] pref) {
   final Atts at = namespaces();
   if (at != null) {
     final byte[] s = at.value(pref);
     if (s != null) return s;
     final ANode n = parent();
     if (n != null) return n.uri(pref);
   }
   return pref.length == 0 ? Token.EMPTY : null;
 }
Пример #2
0
 /**
  * Returns a copy of the namespace hierarchy.
  *
  * @param sc static context (can be {@code null})
  * @return namespaces
  */
 public final Atts nsScope(final StaticContext sc) {
   final Atts ns = new Atts();
   ANode node = this;
   do {
     final Atts nsp = node.namespaces();
     if (nsp != null) {
       for (int a = nsp.size() - 1; a >= 0; a--) {
         final byte[] key = nsp.name(a);
         if (!ns.contains(key)) ns.add(key, nsp.value(a));
       }
     }
     node = node.parent();
   } while (node != null && node.type == NodeType.ELM);
   if (sc != null) sc.ns.inScope(ns);
   return ns;
 }