<ul id="menu">
<li><a href='#'>First Item</a></li>
<li><a href='#'>Second Item</a></li>
</ul>
I can access all links via xpath query.
$result = $crawler->filterXPath('//ul[@id="menu"]/li/a');
but i wonder if is it possible to access parent element of child element using filterXPath() method without editing xpath query in PHP DomCrawler ?
For example i want to access //ul[@id="menu"] using node element in each() method.
$result = $crawler->filterXPath('//ul[@id="menu"]/li/a');
if($result->count() < 1){
exit('Query not found.');
}
$result->each(function (Crawler $node)){
$parentOfNode = $node->parent() // ??
//...
};