how to extract specific row data from a table from a html webpage using JSoup











up vote
0
down vote

favorite












I need to extract specific row data from a table from a html web page based upon a particular string present in the row.



Basically, I need to check if a particular text value is present in the first column of the row and if it does , then I need to extract the row data.



I am trying to parse HTML using jsoup. This is my first time working with jsoup.
I'm getting able to get data of all the rows but not getting able to filter it as required.



To be more specific, here is a part of inspect element data(just one of the rows of many)



<tr rr="8"><td id="ANALYSIS1_ia_pt_cid1x7" bitp="h2" bict="BIDD" biddtp="15" rowspan="9" urrowspan="9" tp="C" cc="2" rr="8" align="left" class="urST3TD urCursorClickable urSTSHL2" style="border-left:0px;border-top:0px;vertical-align:top;height:189px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_1x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**Author Action required**</span></td><td id="ANALYSIS1_ia_pt_cid2x7" bitp="" bict="BIDD" biddtp="15" colspan="2" tp="C" cc="3" rr="8" align="left" class="urST3TD urCursorClickable urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><table cellspacing="0" cellpadding="0" id="ANALYSIS1_ia_mc2_unid0" ct="ML" class="urMatrixLayout" border="0" style="border-collapse:collapse;"><tbody class="urLinStd"><tr><td valign="top" class="urLayoutPadless"><img id="ANALYSIS1_ia_mc35" src="/com.sap.portal.design.urdesigndata/themes/portal/cp_redesign/common/treeview/ico12_treeleaf.gif" style="border-width:0px;width:;height:" alt=""></td><td valign="top" class="urLayoutPadless"><span id="ANALYSIS1_ia_2x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">Result</span></td></tr></tbody></table></td><td id="ANALYSIS1_ia_pt_cid4x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="5" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_4x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid5x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="6" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_5x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid6x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="7" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_6x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid7x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="8" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_7x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid8x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="9" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_8x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid9x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="10" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_9x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid10x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="11" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_10x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid11x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="12" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_11x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid13x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="14" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_13x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid14x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="15" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_14x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid15x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="16" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_15x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid16x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="17" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_16x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">62</span></td><td id="ANALYSIS1_ia_pt_cid17x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="18" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_17x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">42</span></td><td id="ANALYSIS1_ia_pt_cid18x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="19" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_18x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**106**</span></td><td id="ANALYSIS1_ia_pt_cid12x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="13" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_12x8_tv" ct="TV" style="margin:0px;"></span></td></tr>


Here , if a row contains the text "Author Action required" , I need to extract the data of the last column in the same row.



Thanks!










share|improve this question




























    up vote
    0
    down vote

    favorite












    I need to extract specific row data from a table from a html web page based upon a particular string present in the row.



    Basically, I need to check if a particular text value is present in the first column of the row and if it does , then I need to extract the row data.



    I am trying to parse HTML using jsoup. This is my first time working with jsoup.
    I'm getting able to get data of all the rows but not getting able to filter it as required.



    To be more specific, here is a part of inspect element data(just one of the rows of many)



    <tr rr="8"><td id="ANALYSIS1_ia_pt_cid1x7" bitp="h2" bict="BIDD" biddtp="15" rowspan="9" urrowspan="9" tp="C" cc="2" rr="8" align="left" class="urST3TD urCursorClickable urSTSHL2" style="border-left:0px;border-top:0px;vertical-align:top;height:189px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_1x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**Author Action required**</span></td><td id="ANALYSIS1_ia_pt_cid2x7" bitp="" bict="BIDD" biddtp="15" colspan="2" tp="C" cc="3" rr="8" align="left" class="urST3TD urCursorClickable urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><table cellspacing="0" cellpadding="0" id="ANALYSIS1_ia_mc2_unid0" ct="ML" class="urMatrixLayout" border="0" style="border-collapse:collapse;"><tbody class="urLinStd"><tr><td valign="top" class="urLayoutPadless"><img id="ANALYSIS1_ia_mc35" src="/com.sap.portal.design.urdesigndata/themes/portal/cp_redesign/common/treeview/ico12_treeleaf.gif" style="border-width:0px;width:;height:" alt=""></td><td valign="top" class="urLayoutPadless"><span id="ANALYSIS1_ia_2x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">Result</span></td></tr></tbody></table></td><td id="ANALYSIS1_ia_pt_cid4x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="5" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_4x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid5x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="6" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_5x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid6x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="7" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_6x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid7x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="8" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_7x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid8x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="9" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_8x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid9x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="10" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_9x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid10x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="11" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_10x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid11x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="12" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_11x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid13x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="14" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_13x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid14x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="15" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_14x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid15x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="16" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_15x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid16x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="17" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_16x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">62</span></td><td id="ANALYSIS1_ia_pt_cid17x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="18" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_17x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">42</span></td><td id="ANALYSIS1_ia_pt_cid18x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="19" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_18x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**106**</span></td><td id="ANALYSIS1_ia_pt_cid12x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="13" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_12x8_tv" ct="TV" style="margin:0px;"></span></td></tr>


    Here , if a row contains the text "Author Action required" , I need to extract the data of the last column in the same row.



    Thanks!










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I need to extract specific row data from a table from a html web page based upon a particular string present in the row.



      Basically, I need to check if a particular text value is present in the first column of the row and if it does , then I need to extract the row data.



      I am trying to parse HTML using jsoup. This is my first time working with jsoup.
      I'm getting able to get data of all the rows but not getting able to filter it as required.



      To be more specific, here is a part of inspect element data(just one of the rows of many)



      <tr rr="8"><td id="ANALYSIS1_ia_pt_cid1x7" bitp="h2" bict="BIDD" biddtp="15" rowspan="9" urrowspan="9" tp="C" cc="2" rr="8" align="left" class="urST3TD urCursorClickable urSTSHL2" style="border-left:0px;border-top:0px;vertical-align:top;height:189px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_1x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**Author Action required**</span></td><td id="ANALYSIS1_ia_pt_cid2x7" bitp="" bict="BIDD" biddtp="15" colspan="2" tp="C" cc="3" rr="8" align="left" class="urST3TD urCursorClickable urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><table cellspacing="0" cellpadding="0" id="ANALYSIS1_ia_mc2_unid0" ct="ML" class="urMatrixLayout" border="0" style="border-collapse:collapse;"><tbody class="urLinStd"><tr><td valign="top" class="urLayoutPadless"><img id="ANALYSIS1_ia_mc35" src="/com.sap.portal.design.urdesigndata/themes/portal/cp_redesign/common/treeview/ico12_treeleaf.gif" style="border-width:0px;width:;height:" alt=""></td><td valign="top" class="urLayoutPadless"><span id="ANALYSIS1_ia_2x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">Result</span></td></tr></tbody></table></td><td id="ANALYSIS1_ia_pt_cid4x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="5" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_4x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid5x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="6" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_5x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid6x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="7" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_6x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid7x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="8" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_7x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid8x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="9" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_8x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid9x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="10" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_9x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid10x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="11" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_10x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid11x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="12" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_11x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid13x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="14" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_13x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid14x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="15" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_14x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid15x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="16" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_15x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid16x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="17" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_16x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">62</span></td><td id="ANALYSIS1_ia_pt_cid17x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="18" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_17x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">42</span></td><td id="ANALYSIS1_ia_pt_cid18x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="19" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_18x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**106**</span></td><td id="ANALYSIS1_ia_pt_cid12x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="13" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_12x8_tv" ct="TV" style="margin:0px;"></span></td></tr>


      Here , if a row contains the text "Author Action required" , I need to extract the data of the last column in the same row.



      Thanks!










      share|improve this question















      I need to extract specific row data from a table from a html web page based upon a particular string present in the row.



      Basically, I need to check if a particular text value is present in the first column of the row and if it does , then I need to extract the row data.



      I am trying to parse HTML using jsoup. This is my first time working with jsoup.
      I'm getting able to get data of all the rows but not getting able to filter it as required.



      To be more specific, here is a part of inspect element data(just one of the rows of many)



      <tr rr="8"><td id="ANALYSIS1_ia_pt_cid1x7" bitp="h2" bict="BIDD" biddtp="15" rowspan="9" urrowspan="9" tp="C" cc="2" rr="8" align="left" class="urST3TD urCursorClickable urSTSHL2" style="border-left:0px;border-top:0px;vertical-align:top;height:189px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_1x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**Author Action required**</span></td><td id="ANALYSIS1_ia_pt_cid2x7" bitp="" bict="BIDD" biddtp="15" colspan="2" tp="C" cc="3" rr="8" align="left" class="urST3TD urCursorClickable urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><table cellspacing="0" cellpadding="0" id="ANALYSIS1_ia_mc2_unid0" ct="ML" class="urMatrixLayout" border="0" style="border-collapse:collapse;"><tbody class="urLinStd"><tr><td valign="top" class="urLayoutPadless"><img id="ANALYSIS1_ia_mc35" src="/com.sap.portal.design.urdesigndata/themes/portal/cp_redesign/common/treeview/ico12_treeleaf.gif" style="border-width:0px;width:;height:" alt=""></td><td valign="top" class="urLayoutPadless"><span id="ANALYSIS1_ia_2x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">Result</span></td></tr></tbody></table></td><td id="ANALYSIS1_ia_pt_cid4x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="5" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_4x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid5x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="6" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_5x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid6x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="7" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_6x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid7x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="8" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_7x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid8x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="9" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_8x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid9x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="10" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_9x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid10x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="11" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_10x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid11x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="12" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_11x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid13x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="14" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_13x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid14x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="15" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_14x8_tv" ct="TV" style="margin:0px;"></span></td><td id="ANALYSIS1_ia_pt_cid15x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="16" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_15x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">1</span></td><td id="ANALYSIS1_ia_pt_cid16x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="17" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_16x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">62</span></td><td id="ANALYSIS1_ia_pt_cid17x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="18" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_17x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">42</span></td><td id="ANALYSIS1_ia_pt_cid18x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="19" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_18x8_tv" ct="TV" class="urTxtStd" style="white-space:nowrap;">**106**</span></td><td id="ANALYSIS1_ia_pt_cid12x7" bitp="" bict="BIDD" biddtp="10" tp="C" cc="13" rr="8" align="right" class="urST3TD urSubtot" style="border-left:0px;border-top:0px;height:21px;padding:2px 6px 2px 6px ;"><span id="ANALYSIS1_ia_12x8_tv" ct="TV" style="margin:0px;"></span></td></tr>


      Here , if a row contains the text "Author Action required" , I need to extract the data of the last column in the same row.



      Thanks!







      java jsoup html-parsing






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 13:13









      Al Fahad

      739621




      739621










      asked Nov 8 at 11:49









      Sameer Satpathy

      11




      11
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          to get the "Author Action required" field using JSOUP you need to do this:



          Document document = Jsoup.connect(URL).userAgent("Mozilla/5.0").get();
          Elements elements = document.select("tr > td > span");

          for (Element element : elements) {
          if (element.getText().equalsIgnoreCase("Author Action required")) {
          Elements elements = document.select(YOUR_NEXT_QUERY);
          ...
          }
          }


          What you need to do is getting te HTML tags that you want to loop over and check it the text value contained is equal to your desired text. And then do that again to retrieve the element you want in case the first condition is true.



          The .getText() function gets the text contained between HTML tags as for example:



          <tr id="1"><td>hi</td></tr>


          That will return "hi". So if you need anything else related to Web Scrapping feel free to ask me!



          Hope it helps you!






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53207151%2fhow-to-extract-specific-row-data-from-a-table-from-a-html-webpage-using-jsoup%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            to get the "Author Action required" field using JSOUP you need to do this:



            Document document = Jsoup.connect(URL).userAgent("Mozilla/5.0").get();
            Elements elements = document.select("tr > td > span");

            for (Element element : elements) {
            if (element.getText().equalsIgnoreCase("Author Action required")) {
            Elements elements = document.select(YOUR_NEXT_QUERY);
            ...
            }
            }


            What you need to do is getting te HTML tags that you want to loop over and check it the text value contained is equal to your desired text. And then do that again to retrieve the element you want in case the first condition is true.



            The .getText() function gets the text contained between HTML tags as for example:



            <tr id="1"><td>hi</td></tr>


            That will return "hi". So if you need anything else related to Web Scrapping feel free to ask me!



            Hope it helps you!






            share|improve this answer

























              up vote
              1
              down vote













              to get the "Author Action required" field using JSOUP you need to do this:



              Document document = Jsoup.connect(URL).userAgent("Mozilla/5.0").get();
              Elements elements = document.select("tr > td > span");

              for (Element element : elements) {
              if (element.getText().equalsIgnoreCase("Author Action required")) {
              Elements elements = document.select(YOUR_NEXT_QUERY);
              ...
              }
              }


              What you need to do is getting te HTML tags that you want to loop over and check it the text value contained is equal to your desired text. And then do that again to retrieve the element you want in case the first condition is true.



              The .getText() function gets the text contained between HTML tags as for example:



              <tr id="1"><td>hi</td></tr>


              That will return "hi". So if you need anything else related to Web Scrapping feel free to ask me!



              Hope it helps you!






              share|improve this answer























                up vote
                1
                down vote










                up vote
                1
                down vote









                to get the "Author Action required" field using JSOUP you need to do this:



                Document document = Jsoup.connect(URL).userAgent("Mozilla/5.0").get();
                Elements elements = document.select("tr > td > span");

                for (Element element : elements) {
                if (element.getText().equalsIgnoreCase("Author Action required")) {
                Elements elements = document.select(YOUR_NEXT_QUERY);
                ...
                }
                }


                What you need to do is getting te HTML tags that you want to loop over and check it the text value contained is equal to your desired text. And then do that again to retrieve the element you want in case the first condition is true.



                The .getText() function gets the text contained between HTML tags as for example:



                <tr id="1"><td>hi</td></tr>


                That will return "hi". So if you need anything else related to Web Scrapping feel free to ask me!



                Hope it helps you!






                share|improve this answer












                to get the "Author Action required" field using JSOUP you need to do this:



                Document document = Jsoup.connect(URL).userAgent("Mozilla/5.0").get();
                Elements elements = document.select("tr > td > span");

                for (Element element : elements) {
                if (element.getText().equalsIgnoreCase("Author Action required")) {
                Elements elements = document.select(YOUR_NEXT_QUERY);
                ...
                }
                }


                What you need to do is getting te HTML tags that you want to loop over and check it the text value contained is equal to your desired text. And then do that again to retrieve the element you want in case the first condition is true.



                The .getText() function gets the text contained between HTML tags as for example:



                <tr id="1"><td>hi</td></tr>


                That will return "hi". So if you need anything else related to Web Scrapping feel free to ask me!



                Hope it helps you!







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 8 at 15:04









                alvarobartt

                936




                936






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53207151%2fhow-to-extract-specific-row-data-from-a-table-from-a-html-webpage-using-jsoup%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    鏡平學校

                    ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

                    Why https connections are so slow when debugging (stepping over) in Java?