public class ParseTreeTransform
extends java.lang.Object
ParseTreeTransform
stores a set of rules to transform a
DOM. Each rule is an XPath expression which will be evaluated and the
resulting nodes run through a specified function to alter the DOM tree
in place.Constructor and Description |
---|
ParseTreeTransform() |
Modifier and Type | Method and Description |
---|---|
void |
addRule(java.lang.String xpath,
java.util.function.Consumer<org.w3c.dom.Node> rule)
Adds a rule to the transform.
|
void |
transform(org.w3c.dom.Document doc)
Performs a transformation of the specified document in-place using the
rules in this transform.
|
public void addRule(java.lang.String xpath, java.util.function.Consumer<org.w3c.dom.Node> rule)
xpath
- the XPath expression to use for producing a node list.rule
- the function to apply to each node in the resulting list.public void transform(org.w3c.dom.Document doc)
doc
- the document to transform.