Class FUN_CSSPath
- java.lang.Object
-
- org.apache.jena.sparql.function.FunctionBase
-
- org.apache.jena.sparql.function.FunctionBase2
-
- fr.mines_stetienne.ci.sparql_generate.xml.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 attributeattributeName
for the first matched element.
- Author:
- Maxime Lefrançois
-
-
Constructor Summary
Constructors Constructor Description FUN_CSSPath()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeValue
exec(NodeValue html, NodeValue query)
NodeValue
select(org.jsoup.nodes.Element htmldoc, String selectPath)
-
Methods inherited from class org.apache.jena.sparql.function.FunctionBase2
checkBuild, exec
-
Methods inherited from class org.apache.jena.sparql.function.FunctionBase
build, evalArgs, exec, exec
-
-
-
-
Field Detail
-
URI
public static final String URI
- See Also:
- Constant Field Values
-
-
Method Detail
-
exec
public NodeValue exec(NodeValue html, NodeValue query)
- Specified by:
exec
in classFunctionBase2
-
select
public NodeValue select(org.jsoup.nodes.Element htmldoc, String selectPath) throws ExprEvalException
- Throws:
ExprEvalException
-
-