Beispiel #1
0
 /**
  * Returns the value of the specified attribute or {@code null}.
  *
  * @param name attribute to be found
  * @return attribute value
  */
 public byte[] attribute(final QNm name) {
   final BasicNodeIter iter = attributes();
   while (true) {
     final ANode node = iter.next();
     if (node == null) return null;
     if (node.qname().eq(name)) return node.string();
   }
 }
Beispiel #2
0
 @Override
 public boolean eq(final ANode node) {
   return node.type == type
       && (name == null || node.qname(tmpq).eq(name))
       && (ext == null
           || ext == AtomType.ATY
           || (node instanceof DBNode || strip) && ext == AtomType.UTY
           || type == NodeType.ATT
               && (ext == AtomType.AST || ext == AtomType.AAT || ext == AtomType.ATM));
 }
Beispiel #3
0
  /**
   * Parses a jar descriptor.
   *
   * @param io XML input
   * @return jar descriptor container
   * @throws QueryException query exception
   */
  public JarDesc parse(final IO io) throws QueryException {
    final JarDesc desc = new JarDesc();
    try {
      final ANode node = new DBNode(io).children().next();
      for (final ANode next : node.children()) {
        if (next.type != NodeType.ELM) continue;

        final QNm name = next.qname();
        // ignore namespace to improve compatibility
        if (eq(JAR, name.local())) desc.jars.add(next.string());
        else if (eq(CLASS, name.local())) desc.classes.add(next.string());
        // [CG] Packaging: add warning if unknown elements are encountered
      }
      if (desc.jars.isEmpty()) throw BXRE_JARDESC_X.get(info, NOJARS);
      else if (desc.classes.isEmpty()) throw BXRE_JARDESC_X.get(info, NOCLASSES);
      return desc;
    } catch (final IOException ex) {
      throw BXRE_JARFAIL_X.get(info, ex);
    }
  }
Beispiel #4
0
 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
   final ANode node = toEmptyNode(arg(0, qc), qc);
   final QNm qname = node != null ? node.qname() : null;
   return qname != null ? Uri.uri(qname.uri(), false) : Uri.EMPTY;
 }