Package org.codelibs.fess.util
Class PrunedTag
java.lang.Object
org.codelibs.fess.util.PrunedTag
Represents a tag configuration for pruning HTML content during document processing.
This class defines tag patterns that match HTML elements based on tag name, CSS class, ID, or custom attributes.
It is used to identify and remove unwanted HTML elements from crawled documents.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()booleanChecks if this pruned tag configuration matches the given DOM node.static PrunedTag[]Parses a comma-separated string of pruned tag configurations into an array of PrunedTag objects.voidSets a custom attribute name-value pair that this pruned tag should match.voidSets the CSS class name that this pruned tag should match.voidSets the ID attribute value that this pruned tag should match.toString()
-
Constructor Details
-
PrunedTag
Creates a new PrunedTag instance with the specified tag name.- Parameters:
tag- the HTML tag name to match (e.g., "div", "span", "p")
-
-
Method Details
-
matches
Checks if this pruned tag configuration matches the given DOM node. The matching is based on tag name, and optionally ID, CSS class, or custom attributes.- Parameters:
node- the DOM node to check against this pruned tag configuration- Returns:
- true if the node matches this pruned tag configuration, false otherwise
-
hashCode
public int hashCode() -
equals
-
setId
Sets the ID attribute value that this pruned tag should match.- Parameters:
id- the ID attribute value to match
-
setCss
Sets the CSS class name that this pruned tag should match.- Parameters:
css- the CSS class name to match
-
setAttr
Sets a custom attribute name-value pair that this pruned tag should match.- Parameters:
name- the attribute name to matchvalue- the attribute value to match
-
toString
-
parse
Parses a comma-separated string of pruned tag configurations into an array of PrunedTag objects. Each tag configuration follows the pattern: tagname[attr=value].classname#id Examples: - "div.content" matches div elements with class "content" - "span#header" matches span elements with ID "header" - "p[data-type=ad]" matches p elements with data-type attribute equal to "ad"- Parameters:
value- the comma-separated string of pruned tag configurations- Returns:
- an array of PrunedTag objects parsed from the input string
- Throws:
FessSystemException- if the input string contains invalid tag patterns
-