Package com.norconex.commons.lang.xml

# 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 Summary

  Modifier and Type
  Method
  Description
  `static String`
  `attr(String attributeName)`
  Create an XPath attribute reference or an empty string if the attribute name is blank.
  `static XPath`
  `newXPath()`
  Gets a new XPath instance from the default object model.
  `static XPathExpression`
  `newXPathExpression(String expression)`
  Gets a new compiled `XPathExpression` from the given string.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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