I have poor XHTML I need to parse with xpath. It looks like this:

<div class="foo">
  i need this text
  <br/>
  <br/>
  <span>sometext</span>
</div>

<div class="foo">
  <span>some other text</span>
  <span>sometext</span>
</div>

I want to select ALL content with "i need this text" in the first div. My problem is, that the div elements contain whitespaces or other stuff, so that //div[@class="foo"]/text() is returning empty strings for the second div also. I want to ignore these empty fields, how can I do that?

Edit
Report