Using jSoup to search for a node with specific text
How to find this HTML snippet in node using jSoup:
<span style="font-weight: bold">Party Date:</span> 14.08.2012<br>
I want to extract a date from an HTML snippet. The problem is that this piece of HTML can happen anywhere inside the element, so I need to map it using the contained text.
As you noted the question "xpath", I am going to assume that you will decide XPATH. In the absence of information to the contrary, I will make some reasonable assumptions. Let us know if you want to correct or clarify these assumptions.
Assumptions
- span " :".
- " ": , . .
- node, , .
- span .
- .
XPath
XPATH...
//span[.='Party Date:'][1]/following-sibling::text()
... ...
' 14.08.2012'
. XPATH 1.0, XPATH 2.0