parsing - How to get all rows of a column by providing its name using JSOUP in android? -



parsing - How to get all rows of a column by providing its name using JSOUP in android? -

i using jsoup library parse html in android app.this column in html page want parse:

<td width="9%" rowspan = 2>days</td>

now want rows of column.i using next code accomplish goal success far away:

stringbuilder s = new stringbuilder(100); document doc = jsoup.parse(htmlpage); elements links = doc.select("table tr.day"); (element link : links) { string linkhref = link.attr("href"); system.out.println(linkhref); s.append(linkhref); string linktext = link.text(); system.out.println(linktext); s.append(linktext); }

i searched lot of no avail.please help me.thanks in advance.

assuming html looks similar this:

<table> <tbody> <tr> <td width="9%" rowspan="2">days</td> <td>a</td> <td>b</td> <td>c</td> <td>d</td> </tr> </tbody> </table>

if understand aright want below td tag days.

document doc = jsoup.parse(htmlpage); for( element element : doc.select("td:contains(days) ~ *") ) // select followed after 'td' tag 'days' text { system.out.println(element); // elememnt }

using html posted before output:

<td>a</td> <td>b</td> <td>c</td> <td>d</td>

android parsing jsoup

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -