0

Sorry for my english. I use jsop libruary and i try parsing data from table. But i have not good result. I have this html:

<table class="charTable">
<tr>
<th><a href="processor.html">№</a></th>
<th><a href="processor_model.html" >Модель</a></th>
</tr>
<tr valign=top  style="background-color:#FFFFFF">
<td><nobr><input type="checkbox" name="887" class="compare_check">1</nobr></td>
<td><nobr><b><a href="./processor_887.html">Intel Core i7-4940MX (Haswell)</a></b></nobr></td><td>3100</td>
</tr>
<tr>.....</tr>
<tr>.....</tr>
<tr>.....</tr>
<tr>.....</tr>
</table >

I need take this string:

Intel Core i7-4940MX (Haswell)

I do like this:

Elements text = doc.select("tbody > tr > td > nobr > b > a");

And he output me

<a href="./processor_887.html">Intel Core i7-4940MX (Haswell)</a>
4
  • 2
    "... > b > a").first().text() work? Commented Oct 10, 2015 at 18:48
  • @Tim yes, thanks. I did like this doc.select("tbody > tr > td > nobr > b > a").first().toString() but it output only one times. I thins i need get Elements and take for that elent. I will try Commented Oct 10, 2015 at 19:30
  • 1
    ah, ok. so iterate thru text, should work. for (Element e: text) System.out.println(e.text()); Commented Oct 10, 2015 at 19:39
  • 1
    np, accept answer if it worked out for you Commented Oct 11, 2015 at 23:33

1 Answer 1

1

use the text() method of the Element class to grab the node value text.

e.g. for (Element e: text) { System.out.println(e.text()); }

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.