How to select the right div by class with Xpath?

Viewed 78
$divs = $xpathsuj->query("//div[@class='txt-msg  text-enrichi-forum ']");
$div = $divs[$i];

With this XPath command I'm able to select the div with the class "txt-msg text-enrichi-forum " :

<div class="bloc-contenu">
    <div class="txt-msg  text-enrichi-forum ">
        <p>Tu pourrais &eacute;crire en FRANCAIS si ce n'est pas trop demand&eacute;?  
            <img src="http://image.jeuxvideo.com/smileys_img/54.gif" alt=":coeur:" data-code=":coeur:" title=":coeur:" width="21" height="20" /> 
        </p>
    </div>
</div>

But not this one :

<div class="bloc-contenu">
    <div class="txt-msg  text-enrichi-forum ">
        <p> 
            <img src="http://image.jeuxvideo.com/smileys_img/42.gif" alt=":salut:" data-code=":salut:" title=":salut:" width="46" height="41" />
        </p>
    </div>
    <div class="signature-msg  text-enrichi-forum ">
        <p>break;</p>
    </div>
</div>

What am I doing wrong?

1 Answers
Related