title: PHP DOM Xpath - search for class name
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1390568/xpath-how-to-match-attributes-that-contain-a-certain-string">XPath: How to match attributes that contain a certain string</a>  </p>
  </blockquote>
  
  
  
  <p>I'm trying to parse some html with PHP DOM Xpath, but I'm having problems searching for a class name when the element has more than one. I found that if I use the hole attribute value like</p>
  
  <pre><code>$xpath-&gt;query('//div[@class="precodet precodeturgente"]'); 
  </code></pre>
  
  <p>it works, but if I do</p>
  
  <pre><code>$xpath-&gt;query('//div[@class="precodet"]');
  </code></pre>
  
  <p>it won't give me the node value. Sometimes there's only one class, others there are more than one, so what I want to know is if there's a way to search for a single class name.</p>