Class XPathUtils

java.lang.Object
org.springframework.integration.xml.xpath.XPathUtils

public final class XPathUtils extends Object
Utility class for 'xpath' support.
Since:
3.0
Author:
Artem Bilan, Gary Russell
  • Field Details

  • Method Details

    • evaluate

      public static <T> T evaluate(Object object, String xpath, Object... resultArg)
      Utility method to evaluate an xpath on the provided object. Delegates evaluation to an XPathExpression. Note this method provides the #xpath() SpEL function.
      Type Parameters:
      T - The required return type.
      Parameters:
      object - the xml Object for evaluation.
      xpath - an 'xpath' expression String.
      resultArg - an optional parameter to represent the result type of the xpath evaluation. Only one argument is allowed, which can be an instance of NodeMapper or one of these String constants: "string", "boolean", "number", "node" or "node_list".
      Returns:
      the result of the xpath expression evaluation.
      Throws:
      IllegalArgumentException - - if the provided arguments aren't appropriate types or values;
      MessagingException - - if the provided object can't be converted to a Node;
      XPathException - - if the xpath expression can't be evaluated.