示例#1
0
  /**
   * Parses a string as XML and adds the resulting nodes to the specified parent.
   *
   * @param value string to parse
   * @param elem element
   */
  public static void add(final byte[] value, final FElem elem) {

    try {
      final Parser parser = new XMLParser(new IOContent(value), MainOptions.get(), true);
      for (final ANode node : new DBNode(parser).children()) elem.add(node.copy());
    } catch (final IOException ex) {
      // fallback: add string representation
      Util.debug(ex);
      elem.add(value);
    }
  }
示例#2
0
 @Override
 public void plan(final FElem plan) {
   final FElem e = planElem();
   var.plan(e);
   expr.plan(e);
   plan.add(e);
 }
示例#3
0
  /**
   * Creates annotation child elements.
   *
   * @param anns annotations
   * @param parent parent element
   * @param uri include uri
   * @throws QueryException query exception
   */
  final void annotation(final AnnList anns, final FElem parent, final boolean uri)
      throws QueryException {

    for (final Ann ann : anns) {
      final FElem annotation = elem("annotation", parent);
      if (ann.sig != null) {
        annotation.add("name", ann.sig.id());
        if (uri) annotation.add("uri", ann.sig.uri);
      } else {
        annotation.add("name", ann.name.string());
        if (uri) annotation.add("uri", ann.name.uri());
      }

      for (final Item it : ann.args) {
        final FElem literal = elem("literal", annotation);
        literal.add("type", it.type.toString()).add(it.string(null));
      }
    }
  }
示例#4
0
 @Override
 public void plan(final FElem plan) {
   final FElem e = planElem();
   for (final Spec spec : specs) spec.plan(e);
   plan.add(e);
 }