Class ParseTreeTransform

java.lang.Object
noaa.coastwatch.util.expression.ParseTreeTransform

public class ParseTreeTransform extends Object
A 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 Details

    • ParseTreeTransform

      public ParseTreeTransform()
  • Method Details

    • addRule

      public void addRule(String xpath, Consumer<Node> rule)
      Adds a rule to the transform.
      Parameters:
      xpath - the XPath expression to use for producing a node list.
      rule - the function to apply to each node in the resulting list.
    • transform

      public void transform(Document doc)
      Performs a transformation of the specified document in-place using the rules in this transform.
      Parameters:
      doc - the document to transform.