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

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -