I want to extract Text 1, Text 2 and Text 3 from the HTML below in one go using XPath. Is that possible?
When I run
//div/strong/a/text()/../../../div/span/span/span/span/text()
I only get Text 2 (I haven't included the path for Text 3 just yet).
<div>
<strong>
<a>
Text 1
</a>
</strong>
<div>
<span>
<span>
<span>
<span >
Text 2
</span>
</span>
</span>
</span>
<span>
<span>
<span>
<span>
Text 3
</span>
</span>
</span>
</span>
</div>
</div>
I have read several other questions, like these
XPath: How to collect multiple texts fragments from an XHTML node?
XPath expression: selecting text nodes between element nodes
but none of them applies to my situation.