Class FUN_CSSPath

  • All Implemented Interfaces:
    Function

    public class FUN_CSSPath
    extends FunctionBase2
    Binding function fun:CSSPath evaluates a CSS Selector over a HTML document and can return (a) the outer HTML, (b) the inner text, or (c) the value of an attribute. The parameters are defined as follows
    • Param 1: (html) is a literal that contains a HTML document;
    • Param 2: (cssSelector) is the CSS Selector. See https://jsoup.org/apidocs/org/jsoup/select/Selector.html for the base syntax specification. By default, the output is the outer HTML of the first matched element. However, two additions to the CSS Selector syntax can change this behaviour:
      • (if the selector ends with /text()) the output is the combined text of the first matched element and all its children. Whitespace is normalized and trimmed.
      • (if the selector ends with @attributeName) the output is the value of the attribute attributeName for the first matched element.
    The output is a string literal.
    Author:
    Maxime Lefrançois