java - How to parse 'div' without name? -


using jsoup:

element movie_div = doc.select("div.movie").first(); 

i got such html-code:

<div class="movie">      <div>          <div>             <strong>year:</strong> 2014         </div>          <div>             <strong>country:</strong> usa         </div>      </div>  </div> 

how can use jsoup extract country , year?

for example html want extracted values "2014" , "usa".

thanks.

use

element e = doc.select("div.movie").first().child(0); list<textnode> textnodes = e.child(0).textnodes(); string year = textnodes.get(textnodes.size()-1).text().trim(); textnodes = e.child(1).textnodes(); string country = textnodes.get(textnodes.size()-1).text().trim(); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -