Is it possible to use PHP's DOMXPath (or a similar alternative) to extract the value bar
but not the value foo
from the following structure?
<div>
<p><span>foo</span>bar</p>
</div>
All of my attempts so far have returned content from the node's descendants as well as from the node itself, which is not what I want in this case.