Ejemplo n.º 1
0
  /**
   * Node-Name operation.
   *
   * @param args Result from the expressions evaluation.
   * @throws DynamicError Dynamic error.
   * @return Result of fn:node-name operation.
   */
  public static ResultSequence node_name(Collection args) throws DynamicError {
    Collection cargs = Function.convert_arguments(args, expected_args());

    ResultSequence arg1 = (ResultSequence) cargs.iterator().next();
    if (arg1.empty()) return ResultBuffer.EMPTY;

    NodeType nt = (NodeType) arg1.first();

    QName nodename = nt.node_name();
    if (nodename == null) return ResultBuffer.EMPTY;

    return nodename;
  }
Ejemplo n.º 2
0
  public ResultSequence constructor(ResultSequence arg) throws DynamicError {
    if (arg.empty()) return ResultBuffer.EMPTY;

    AnyAtomicType aat = (AnyAtomicType) arg.first();
    String strValue = aat.getStringValue();

    if (!isConstraintSatisfied(strValue)) {
      // invalid input
      DynamicError.throw_type_error();
    }

    return new XSIDREF(strValue);
  }