title: How do I do an XPath query on a DOMNode?
body: <p>Is there a way to do an xpath query on a DOMNode? Or at least convert it to a DOMXPath?</p>
  
  <pre><code>&lt;html&gt;
    ...
    &lt;div id="content"&gt;
       ...
       &lt;div class="listing"&gt;
           ...
           &lt;div&gt;&lt;/div&gt;
           &lt;div&gt;&lt;/div&gt;
           &lt;div  class='foo'&gt;
             &lt;h3&gt;Get me 1&lt;/h3&gt;
             &lt;a&gt;and me too 1&lt;/a&gt;
           &lt;/div&gt;
       &lt;/div&gt;
       &lt;div class="listing"&gt;
           ...
           &lt;div&gt;&lt;/div&gt;
           &lt;div&gt;&lt;/div&gt;
           &lt;div class='foo'&gt;
             &lt;h3&gt;Get me 2&lt;/h3&gt;
             &lt;a&gt;and me too 1&lt;/a&gt;
           &lt;/div&gt;
       &lt;/div&gt;
       ....
    &lt;/div&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>$html_dom = new DOMDocument();
  @$html_dom-&gt;loadHTML($html);
  $x_path = new DOMXPath($html_dom);
  
  $nodes= $x_path-&gt;query("//div[@id='content']//div[@class='listing']");
  
  foreach ($nodes as $node)
  {
    // I want to further dig down here using query on a DOMNode
  }
  </code></pre>