You are here

public function Crawler::filterXPath in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dom-crawler/Crawler.php \Symfony\Component\DomCrawler\Crawler::filterXPath()

Filters the list of nodes with an XPath expression.

The XPath expression is evaluated in the context of the crawler, which is considered as a fake parent of the elements inside it. This means that a child selector "div" or "./div" will match only the div elements of the current crawler, not their children.

Parameters

string $xpath An XPath expression:

Return value

Crawler A new instance of Crawler with the filtered list of nodes

File

vendor/symfony/dom-crawler/Crawler.php, line 628

Class

Crawler
Crawler eases navigation of a list of \DOMElement objects.

Namespace

Symfony\Component\DomCrawler

Code

public function filterXPath($xpath) {
  $xpath = $this
    ->relativize($xpath);

  // If we dropped all expressions in the XPath while preparing it, there would be no match
  if ('' === $xpath) {
    return $this
      ->createSubCrawler(null);
  }
  return $this
    ->filterRelativeXPath($xpath);
}