Class DomNodeUtil

java.lang.Object
org.htmlunit.html.DomNodeUtil

public class DomNodeUtil extends Object
DomNode helper methods.
Author:
tom.fennelly@gmail.com
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <E> List<E>
    selectNodes(org.htmlunit.html.DomNode domNode, String xpathExpr)
    Evaluates an XPath expression from the specified node, returning the resultant nodes.
    static <X> X
    selectSingleNode(org.htmlunit.html.DomNode domNode, String xpathExpr)
    Evaluates the specified XPath expression from this node, returning the first matching element, or null if no node matches the specified XPath expression.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DomNodeUtil

      public DomNodeUtil()
  • Method Details

    • selectNodes

      public static <E> List<E> selectNodes(org.htmlunit.html.DomNode domNode, String xpathExpr)
      Evaluates an XPath expression from the specified node, returning the resultant nodes.

      Calls WebClientUtil.waitForJSExec(WebClient) before executing the query.

      Parameters:
      domNode - the node to start searching from
      xpathExpr - the XPath expression
      Returns:
      the list of objects found.
    • selectSingleNode

      public static <X> X selectSingleNode(org.htmlunit.html.DomNode domNode, String xpathExpr)
      Evaluates the specified XPath expression from this node, returning the first matching element, or null if no node matches the specified XPath expression.

      Calls WebClientUtil.waitForJSExec(WebClient) before executing the query.

      Parameters:
      domNode - the node to start searching from
      xpathExpr - the XPath expression
      Returns:
      the first element matching the specified XPath expression