Class XpathUtil

java.lang.Object
com.norconex.commons.lang.xml.XpathUtil

public final class XpathUtil extends Object
XPath-related utility methods.
Since:
3.0.0
  • Method Details

    • attr

      public static String attr(String attributeName)
      Create an XPath attribute reference or an empty string if the attribute name is blank.
      Parameters:
      attributeName - the attribute name
      Returns:
      the attribute name, prefixed with @, or an empty string (never null)
    • newXPath

      public static XPath newXPath()
      Gets a new XPath instance from the default object model.
      Returns:
      new XPath instance
    • newXPathExpression

      public static XPathExpression newXPathExpression(String expression)
      Gets a new compiled XPathExpression from the given string.
      Parameters:
      expression - the XPath string
      Returns:
      compiled XPath expression