Hi,

>From: Vikash Kumar <vikashkumar051 / gmail.com>
>Reply-To: ruby-talk / ruby-lang.org
>To: ruby-talk / ruby-lang.org (ruby-talk ML)
>Subject: How to get data from html table
>Date: Mon, 27 Nov 2006 20:20:54 +0900
>
>I want to store the values of a table in different variables, I have the
>following table structure:
>
><table width="579">
>   <tr class="even">
>     <td class width="65">&nbsp;Case5-04</td>
>     <td class width="130">10/11/2006 23:24:33</td>
>     <td class width="61">Case5-04</td>
>     <td class width="32">1005</td>
>     <td class width="59">Sell</td>
>     <td class width="36">1,000</td>
>     <td class width="34">ARP</td>
>     <td class width="52">$36.90</td>
>   </tr>
>   <tr class="odd">
>     <td class width="65">&nbsp;Case5-03</td>
>     <td class width="130">10/11/2006 23:20:07</td>
>     <td class width="61">Case5-03</a></td>
>     <td class width="32">1005</td>
>     <td class width="59">Buy</td>
>     <td class width="36">1,500</td>
>     <td class width="34">ARP</td>
>     <td class width="52">$36.70</td>
>   </tr>
>   <tr class="even">
>     <td class width="65">&nbsp;Case4-04</td>
>     <td class width="130">10/11/2006 05:28:54</td>
>     <td class width="61">Case4-04</a></td>
>     <td class width="32">1004</td>
>     <td class width="59">Sell</td>
>     <td class width="36">300</td>
>     <td class width="34">RIL</td>
>     <td class width="52">$490.00</td>
>   </tr>
>   <tr class="odd">
>     <td class width="65">&nbsp;Case4-03</td>
>     <td class width="130">10/11/2006 05:21:32</td>
>     <td class width="61">Case4-03</a></td>
>     <td class width="32">1004</td>
>     <td class width="59">Buy</td>
>     <td class width="36">200</td>
>     <td class width="34">RIL</td>
>     <td class width="52">$489.90</td>
>   </tr>
></table>
>
>I want to store the values in variables so that I can compare records.
>Please help me out how to do this in ruby.
>
Here is another way:

After saving the html table text to file 'w.xml',
You can deal the value like this:

require 'rexml/document'
include REXML
doc = Document.new File.new("w.xml")
doc.elements.each("*/tr/td") {|e|
  puts e.texts
}


Regards,

Park Heesob

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/