java - How to get text & Other tags between specific tags using Jericho HTML parser? -
i have html file contains specific tag, e.g. <table cellspacing=0> , end tag </table>. want between tags. using jericho html parser in java parse html. possible text & other tags between specific tags in jericho parser?
for example:
<table cellspacing=0> <tr><td>hello</td> <td>how you</td></tr> </table> answer:
<tr><td>hello</td> <td>how you</td></tr>
once have found element of table, have call getcontent().tostring(). here's quick example using sample html:
source source = new source("<table cellspacing=0>\n" + " <tr><td>hello</td> \n" + " <td>how you</td></tr>\n" + "</table>"); element table = source.getfirstelement(); string tablecontent = table.getcontent().tostring(); system.out.println(tablecontent); output:
<tr><td>hello</td> <td>how you</td></tr>
Comments
Post a Comment