Forum: Ruby need only the tags which are at the first level

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bee1159661d43b0c5b3410d49e95fc51?d=identicon&s=25 Shanmu Gam (shanmu)
on 2008-12-03 15:22
 require 'rubygems'
require 'hpricot'

elements = Hpricot("<table>
  <tr>
    <td>...stuff I don't want...</td>
  </tr>
  <tr>
    <td>
       <table>
         ------------rows i want
         <tr>
           <td>Field 0
             <table>
               <tr>
                 <td>Field 1</td>
                 <td>Field 2</td>
               </tr>
             </table>
           </td>
           <td>Field 3</td>
           <td>Field 4, Field 5</td>
         </tr>
         ------------end of rows i want
       </table>
    </td>
  </tr>
</table>")

from this above code, in second table, i need only the first level of
<td> values and i dont need the second level <td> tags which says "Field
1 Field 2" , i mean the output should be "Field 0 Field 3 Field 4" . i
tried but i got all <td> values
44d59c6c5a7e3435409ebe94c9aa9db5?d=identicon&s=25 Srikanth Jeeva (srikanth_j)
on 2008-12-08 05:46
guhit..
44d59c6c5a7e3435409ebe94c9aa9db5?d=identicon&s=25 Srikanth Jeeva (srikanth_j)
on 2008-12-09 12:11
using/..

Following_siblings method..

..
Bee1159661d43b0c5b3410d49e95fc51?d=identicon&s=25 Shanmu Gam (shanmu)
on 2008-12-10 07:05
Srikanth Jeeva wrote:
> using/..
>
> Following_siblings method..
>
> ..

thanks for your reply
This topic is locked and can not be replied to.