If you have an idea or an easier way of doing this please let me know. I'm trying to parse through the following html page, what I want to do is save each row of the table that has <tr> tag into a file, then print the next row starting with <tr> on the next line and so on till it reaches the bottom of the page which ends with </tr>. In other words I want to extract the Country names and the numbers and save it in a table format, into a file.
I tried several things but seems like I ain't getting anywhere. I'm trying to find a way to avoid all the tags and get country names and the digits.
I would appreciate your help if you have ideas of how to do this. Thanks.
Here is the html page, I ignored the <table> & </table> tags.
<tr><td colspan="8"><div align="right">
<b>16 July 2001</b>
</td>
</tr>
<tr bgcolor="#d1deef"">
<td width="31%">Currency Name</td>
<td width="10%">US Dollar</td>
<td width="10%">Euro</td>
<td width="10%">British Pound</td>
<td width="10%">Yen</td>
<td width="10%">Swiss Franc</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
US Dollar</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
0.8542
</td>
<td width=10% bgcolor="#bcdef6">
1.4043
</td>
<td width=10% bgcolor="#bcdef6">
0.008015
</td>
<td width=10% bgcolor="#bcdef6">
0.5651
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
Euro</td>
<td width=10% bgcolor="#bcdef6">
1.1707
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
1.6426
</td>
<td width=10% bgcolor="#bcdef6">
0.009355
</td>
<td width=10% bgcolor="#bcdef6">
0.6611
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
British Pound</td>
<td width=10% bgcolor="#bcdef6">
0.7121
</td>
<td width=10% bgcolor="#bcdef6">
0.6088
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
0.005692
</td>
<td width=10% bgcolor="#bcdef6">
0.4023
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
Yen</td>
<td width=10% bgcolor="#bcdef6">
124.7661
</td>
<td width=10% bgcolor="#bcdef6">
106.8947
</td>
<td width=10% bgcolor="#bcdef6">
175.6852
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
70.4792
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
Swiss Franc</td>
<td width=10% bgcolor="#bcdef6">
1.7696
</td>
<td width=10% bgcolor="#bcdef6">
1.5126
</td>
<td width=10% bgcolor="#bcdef6">
2.4857
</td>
<td width=10% bgcolor="#bcdef6">
0.014189
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
</tr>
I tried several things but seems like I ain't getting anywhere. I'm trying to find a way to avoid all the tags and get country names and the digits.
I would appreciate your help if you have ideas of how to do this. Thanks.
Here is the html page, I ignored the <table> & </table> tags.
<tr><td colspan="8"><div align="right">
<b>16 July 2001</b>
</td>
</tr>
<tr bgcolor="#d1deef"">
<td width="31%">Currency Name</td>
<td width="10%">US Dollar</td>
<td width="10%">Euro</td>
<td width="10%">British Pound</td>
<td width="10%">Yen</td>
<td width="10%">Swiss Franc</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
US Dollar</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
0.8542
</td>
<td width=10% bgcolor="#bcdef6">
1.4043
</td>
<td width=10% bgcolor="#bcdef6">
0.008015
</td>
<td width=10% bgcolor="#bcdef6">
0.5651
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
Euro</td>
<td width=10% bgcolor="#bcdef6">
1.1707
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
1.6426
</td>
<td width=10% bgcolor="#bcdef6">
0.009355
</td>
<td width=10% bgcolor="#bcdef6">
0.6611
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
British Pound</td>
<td width=10% bgcolor="#bcdef6">
0.7121
</td>
<td width=10% bgcolor="#bcdef6">
0.6088
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
0.005692
</td>
<td width=10% bgcolor="#bcdef6">
0.4023
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
Yen</td>
<td width=10% bgcolor="#bcdef6">
124.7661
</td>
<td width=10% bgcolor="#bcdef6">
106.8947
</td>
<td width=10% bgcolor="#bcdef6">
175.6852
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
<td width=10% bgcolor="#bcdef6">
70.4792
</td>
</tr>
<tr><td width=31% bgcolor=#d1deef>
Swiss Franc</td>
<td width=10% bgcolor="#bcdef6">
1.7696
</td>
<td width=10% bgcolor="#bcdef6">
1.5126
</td>
<td width=10% bgcolor="#bcdef6">
2.4857
</td>
<td width=10% bgcolor="#bcdef6">
0.014189
</td>
<td width=10% bgcolor="#bcdef6">
-
</td>
</tr>