title: Can't find error with xpath query, `undefined method DOMDocument`
body: <p>I'm getting a <code>Call to undefined method DOMDocument::xpath()</code> on the <code>$level1</code> line of my code:</p>
  
  <pre><code>          $doc = new DOMDocument();
            $doc-&gt;strictErrorChecking = FALSE;
            $doc-&gt;loadHTML($html);
            $xml = simplexml_import_dom($doc);
            $level1 = $doc-&gt;xpath('//*[contains(concat(" ", normalize-space(@class), " "), " category-wrap ")]/h2/a');
  </code></pre>
  
  <p>Here is the html it's loading (via <code>file_get_contents()</code>):</p>
  
  <pre><code>&lt;div class="category-wrap"&gt;
     &lt;a href='#'&gt;LINK&lt;/a&gt;
     &lt;h2&gt;&lt;a href="#"&gt;Trying to get this....&lt;/a&gt;&lt;/h2&gt;
     &lt;p&gt;A description&lt;/p&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm using <a href="https://stackoverflow.com/questions/8808921/selecting-a-css-class-with-xpath" title="this question">this answer</a> as a reference for the xpath query.</p>
  
  <p>What is wrong with my query?</p>