0

I have this code:

<div id="g4iloprop">
<h4>HF propagation conditions: <span class="date">2012 Sep 19 1205 UTC</span></h4>
<p><b><span title="10.7cm solar flux">Solar flux:</span></b> 104<img src="nc.gif" alt="no change" hspace="2" /> <b><span title="Mid-latitude A Index">A:</span></b> 8<img 

Prompt please as to me to take value 104 which is between tags </b> 104<img

Thanks.

1 Answer 1

2

Try this:

String html = // your html here

Document doc = Jsoup.parse(html);
Elements elements = doc.select("b + img");


for( Element e : elements )
{
    Node value = e.previousSibling();

    // eg. print the node, here the output is 104 and 8
    System.out.println(value.toString());
}

If you only need the first value, you can replace the for-Loop with this:

Node value = elements.first().previousSibling();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.