예제 #1
0
파일: Docs.java 프로젝트: phspaelti/basex
 /**
  * Performs the doc function.
  *
  * @param qc query context
  * @return result
  * @throws QueryException query exception
  */
 ANode doc(final QueryContext qc) throws QueryException {
   final Item it = exprs[0].item(qc, info);
   if (it == null) return null;
   final byte[] in = toToken(it);
   if (!Uri.uri(in).isValid()) throw INVDOC_X.get(info, in);
   return qc.resources.doc(new QueryInput(string(in)), sc.baseIO(), info);
 }
예제 #2
0
파일: Docs.java 프로젝트: phspaelti/basex
  /**
   * Returns a collection.
   *
   * @param qc query context
   * @return collection
   * @throws QueryException query exception
   */
  Value collection(final QueryContext qc) throws QueryException {
    // return default collection
    final Item it = exprs.length == 0 ? null : exprs[0].atomItem(qc, info);
    if (it == null) return qc.resources.collection(info);

    // check if reference is valid
    final byte[] in = toToken(it);
    if (!Uri.uri(in).isValid()) throw INVCOLL_X.get(info, in);
    return qc.resources.collection(new QueryInput(string(in)), sc.baseIO(), info);
  }