Is there a way to do an xpath query on a DOMNode? Or at least convert it to a DOMXPath?
<html>
...
<div id="content">
...
<div class="listing">
...
<div></div>
<div></div>
<div class='foo'>
<h3>Get me 1</h3>
<a>and me too 1</a>
</div>
</div>
<div class="listing">
...
<div></div>
<div></div>
<div class='foo'>
<h3>Get me 2</h3>
<a>and me too 1</a>
</div>
</div>
....
</div>
</html>
This is my code. I am trying to get a list of array that has the values of the h3 and a tags in each array. To do that, I needed to get each listing, and then get the h3 and a tag's value in each listing.
$html_dom = new DOMDocument();
@$html_dom->loadHTML($html);
$x_path = new DOMXPath($html_dom);
$nodes= $x_path->query("//div[@id='content']//div[@class='listing']");
foreach ($nodes as $node)
{
// I want to further dig down here using query on a DOMNode
}