A
Adam Dullenty
Hi there,
I'm fairly new to Ruby, previously I was an average programmer in Java,
so it's all a bit foreign to me - especially XPath and cSS. I would be
grateful if someone could give me a hand with a problem I'm having. I
have a table which I'm trying to get the fields from in a certain way.
The table is in the form:
<table>
<tr>
<td>...stuff I don't want...</td>
</tr>
<tr>
<td>
<table>
------------rows i want
<tr>
<td>
<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>
I have managed to get HPricot to parse the page and return that HTML for
the table, however I'm struggling to get it into an array in the form
["Field 1", "Field 2", "Field 3", "Field 4", "Field 5"] for each row. I
would have hoped there would be some kind of built in method for
extracting data from a table, but I can't find one.
Thanks again, look forward to a reply
Adam
I'm fairly new to Ruby, previously I was an average programmer in Java,
so it's all a bit foreign to me - especially XPath and cSS. I would be
grateful if someone could give me a hand with a problem I'm having. I
have a table which I'm trying to get the fields from in a certain way.
The table is in the form:
<table>
<tr>
<td>...stuff I don't want...</td>
</tr>
<tr>
<td>
<table>
------------rows i want
<tr>
<td>
<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>
I have managed to get HPricot to parse the page and return that HTML for
the table, however I'm struggling to get it into an array in the form
["Field 1", "Field 2", "Field 3", "Field 4", "Field 5"] for each row. I
would have hoped there would be some kind of built in method for
extracting data from a table, but I can't find one.
Thanks again, look forward to a reply
Adam