示例#1
0
  /**
   * Returns the value of the expression as a number.
   *
   * @param node the current node
   * @param env the variable environment.
   */
  public double evalNumber(Node node, ExprEnvironment env) throws XPathException {
    Node value = _pattern.findAny(node, env);

    if (value == null) return Double.NaN;

    String string = XmlUtil.textValue(value);

    return stringToNumber(string);
  }
示例#2
0
 /**
  * Returns true if there are any patterns matching the pattern.
  *
  * @param node the current node
  * @param env the variable environment.
  */
 public boolean evalBoolean(Node node, ExprEnvironment env) throws XPathException {
   return _pattern.findAny(node, env) != null;
 }
示例#3
0
  /**
   * Returns the value of the node set expression as a string. The value is the text value of the
   * first node.
   *
   * @param node the current node
   * @param env the variable environment
   * @return the combined text value of the node.
   */
  public String evalString(Node node, ExprEnvironment env) throws XPathException {
    Node value = _pattern.findAny(node, env);

    if (value == null) return "";
    else return XmlUtil.textValue(value);
  }