Class JsoupTool
java.lang.Object
org.apache.velocity.tools.generic.SafeConfig
io.github.cs1302uga.JsoupTool
@DefaultKey("soup")
public class JsoupTool
extends org.apache.velocity.tools.generic.SafeConfig
An Apache Velocity tool that provides utility methods to manipulate HTML code using
 jsoup HTML5 parser.
- Author:
 - Michael E. Cotterell
 
- 
Field Summary
Fields inherited from class org.apache.velocity.tools.generic.SafeConfig
LOCK_CONFIG_KEY, log, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionGet the output encoding.org.jsoup.nodes.ElementParse the supplied HTMLcontentstring using jsoup.org.jsoup.select.ElementsSelect elements in the supplied HTMLcontentstring that match the selector CSS query, with this element as the starting context.protected voidsetOutputEncoding(Charset outputEncoding) Set the output encoding.Methods inherited from class org.apache.velocity.tools.generic.SafeConfig
configure, configure, getLog, initLogger, isConfigLocked, isSafeMode, setLockConfig, setSafeMode 
- 
Constructor Details
- 
JsoupTool
public JsoupTool()Construct aJsoupToolobject. 
 - 
 - 
Method Details
- 
getOutputEncoding
 - 
setOutputEncoding
Set the output encoding.- Parameters:
 outputEncoding- the desired output encoding
 - 
parse
Parse the supplied HTMLcontentstring using jsoup.- Parameters:
 content- HTML content string- Returns:
 - An 
Elementthat wraps the suppliedcontent. 
 - 
select
Select elements in the supplied HTMLcontentstring that match the selector CSS query, with this element as the starting context. Matched elements may include this element, or any of its children.- Parameters:
 content- HTML content stringcssQuery- a selector CSS-like query- Returns:
 - The selected elements.
 
 
 -