src/main/java/org/jsoup/nodes/NodeUtils.java
/**
     This impl works by compiling the input xpath expression, and then evaluating it against a W3C Document converted
     from the original jsoup element. The original jsoup elements are then fetched from the w3c doc user data (where we
     stashed them during conversion). This process could potentially be optimized by transpiling the compiled xpath
     expression to a jsoup Evaluator when there's 1:1 support, thus saving the W3C document conversion stage.
     */
This impl works by compiling the input xpath expression, and then evaluating it against a W3C Document converted
from the original jsoup element. The original jsoup elements are then fetched from the w3c doc user data (where we
stashed them during conversion). This process could potentially be optimized by transpiling the compiled xpath
expression to a jsoup Evaluator when there's 1:1 support, thus saving the W3C document conversion stage.
This impl works by compiling the input xpath expression and then evaluating it against a W3C Document converted from the original jsoup element . The original jsoup elements are then fetched from the w3c doc user data ( where we stashed them during conversion ) . This process could potentially be optimized by transpiling the compiled xpath expression to a jsoup Evaluator when there ' s 1 : 1 support thus saving the W3C document conversion stage .
static <T extends Node> List<T> selectXpath(String xpath, Element el, Class<T> nodeType) {
        Validate.notEmpty(xpath);
        Validate.notNull(el);
        Validate.notNull(nodeType);
        W3CDom w3c = new W3CDom();
        org.w3c.dom.Document wDoc = w3c.fromJsoup(el);
        org.w3c.dom.Node contextNode = w3c.contextNode(wDoc);
        NodeList nodeList = w3c.selectXpath(xpath, contextNode);
        return w3c.sourceNodes(nodeList, nodeType);
    }
static < T extends Node > List < T > selectXpath ( String xpath , Element el , Class < T > nodeType ) { Validate . notEmpty ( xpath ) ; Validate . notNull ( el ) ; Validate . notNull ( nodeType ) ; W3CDom w3c = new W3CDom ( ) ; org . w3c . dom . Document wDoc = w3c . fromJsoup ( el ) ; org . w3c . dom . Node contextNode = w3c . contextNode ( wDoc ) ; NodeList nodeList = w3c . selectXpath ( xpath , contextNode ) ; return w3c . sourceNodes ( nodeList , nodeType ) ; }
This impl works by compiling the input xpath expression, and then evaluating it against a W3C Document converted
from the original jsoup element.
This impl works by compiling the input xpath expression and then evaluating it against a W3C Document converted from the original jsoup element .