public class AttributeCleaner extends Cleaner
Cleaner
settings.
Constructor and Description |
---|
AttributeCleaner(java.lang.String attributeKey)
Builds a new cleaner for the specified attribute.
|
AttributeCleaner(java.lang.String attributeKey,
java.lang.String splitRegex,
java.lang.String delimiter)
Builds a new cleaner for the specified attribute, which may contains multiple value seperated with the specified pattern.
|
Modifier and Type | Method and Description |
---|---|
void |
clean(org.jsoup.nodes.Node node)
Clean
style attribute in the specified node and its descendant. |
java.lang.String |
clean(java.lang.String unsafeValue)
Clean the specified attribute value.
|
protected java.lang.String |
cleanSingleValue(java.lang.String unsafeValue)
Clean individual value of the attribute.
|
void |
configureFromProperties(JProperties prop)
Configure the current cleaner with the specified properties.
|
addBlacklistedValue, addWhitelistedValue, getBlacklist, getBlacklistRegex, getDefaultBehavior, getWhitelist, getWhitelistRegex, isAuthorized, isEnabled, removeBlacklistedValue, removeWhitelistedValue, setBlacklistRegex, setDefaultBehavior, setEnabled, setWhitelistRegex, toString
public AttributeCleaner(java.lang.String attributeKey)
attributeKey
- the name of the HTML attribute whose value is to be cleaned. (eg "id"
)public AttributeCleaner(java.lang.String attributeKey, java.lang.String splitRegex, java.lang.String delimiter)
attributeKey
- the name of the HTML attribute whose value is to be cleaned. (eg "class"
)splitRegex
- a regular expression used to split multiple values of the attribute (eg "\s"
).delimiter
- a string used to seperate multiple values once they have been cleaned (eg " "
).public void configureFromProperties(JProperties prop)
Cleaner
configureFromProperties
in class Cleaner
prop
- a instance of JProperties, must not be nullpublic java.lang.String clean(java.lang.String unsafeValue)
unsafeValue
- value of the HTML attributeprotected java.lang.String cleanSingleValue(java.lang.String unsafeValue)
When attributes accept several values (such as "class" attribute),
this method is invoked for each of this value.
When attributes accept only one value (such as "id" attribute),
this method is invoked one for the whole attribute value.
Override to provide custom cleaning behavior.
unsafeValue
- the unsafe attribute value (or "split" value in case multiple values)public void clean(org.jsoup.nodes.Node node)
style
attribute in the specified node and its descendant.node
- the node to clean, must not be nullCopyright © 2001-2017 Jalios SA. All Rights Reserved.