I
I
Ilnar2014-07-29 19:54:36
Java
Ilnar, 2014-07-29 19:54:36

How to parse HTML strings as needed?

How can I parse the following.
Date, text1, text2, etc.

<tr >  
  <td onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="date">29-07 21:00</td>  
  <a rel="" title=" Текст1">  Текст2</a></td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст3</td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст4</td> 
  <td align="center" style="width:50px;">    <div class="orating" id="orating-2225111">    <a href="#" class="orating_m" title="Не нравится" onclick="orating(2225111,0);return false;"></a>    <a href="#" class="orating_p" title="Нравится" onclick="orating(2225111,1);return false;"></a>    <a href="#" class="orating_res" onclick="ostats(2225111,1,true);return false;">Текст5</a>    </div><a onclick="showdialog(); return false;"></a>  </td>
  </tr>
 
<tr >  
  <td onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="date">29-07 21:00</td>  
  <a rel="" title=" Текст1">  Текст2</a></td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст3</td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст4</td> 
  <td align="center" style="width:50px;">    <div class="orating" id="orating-2225111">    <a href="#" class="orating_m" title="Не нравится" onclick="orating(2225111,0);return false;"></a>    <a href="#" class="orating_p" title="Нравится" onclick="orating(2225111,1);return false;"></a>    <a href="#" class="orating_res" onclick="ostats(2225111,1,true);return false;">Текст5</a>    </div><a onclick="showdialog(); return false;"></a>  </td>
  </tr>
 
<tr >  
  <td onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="date">29-07 21:00</td>  
  <a rel="" title=" Текст1">  Текст2</a></td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст3</td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст4</td> 
  <td align="center" style="width:50px;">    <div class="orating" id="orating-2225111">    <a href="#" class="orating_m" title="Не нравится" onclick="orating(2225111,0);return false;"></a>    <a href="#" class="orating_p" title="Нравится" onclick="orating(2225111,1);return false;"></a>    <a href="#" class="orating_res" onclick="ostats(2225111,1,true);return false;">Текст5</a>    </div><a onclick="showdialog(); return false;"></a>  </td>
  </tr>
 
<tr >  
  <td onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="date">29-07 21:00</td>  
  <a rel="" title=" Текст1">  Текст2</a></td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст3</td> 
  <td  onclick="ShowOrHidetr('2225111'); return false;" nowrap="nowrap" class="when">Текст4</td> 
  <td align="center" style="width:50px;">    <div class="orating" id="orating-2225111">    <a href="#" class="orating_m" title="Не нравится" onclick="orating(2225111,0);return false;"></a>    <a href="#" class="orating_p" title="Нравится" onclick="orating(2225111,1);return false;"></a>    <a href="#" class="orating_res" onclick="ostats(2225111,1,true);return false;">Текст5</a>    </div><a onclick="showdialog(); return false;"></a>  </td>
  </tr>

from String variable.. to ArrayList

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Moxa, 2014-07-30
@Moxa

look towards jsoup

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question