java - Jsoup iterate over Elements causes duplicated output -


i have page link extract data (i want tables' tds attributes). this image source sample

i used for-loop iteration via elements have extract attributes of . duplicated output.

the output should output @ image on end of post

document doc = jsoup.connect("http://www.saudisale.com/ss_a_mpg.aspx").get(); elements elements = doc.select("table").select("tbody").select("tr").select("td") ;  for(element e:elements) {     system.out.println(e.select("span[id~=label4]").text() +              "\t" + e.select("input[id$=imagebutton1]").attr("src") +              "\t" + "" + e.select("span[id~=label13]").text()); } 

this output them, duplicated!!! :

enter image description here

the output should this:- 

enter image description here

would please try below code?

    elements description = doc.select("tbody");     doc=jsoup.parse(description.html());     description = doc.select("td");      for(int j = 0; j < description.size(); ++ j)     {         string bodytext = description.eq(j).text(); // bodytext text of each td     } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -