in reply to Re: How to restore the colors of a webpage when extracting data
in thread How to restore the colors of a webpage when extracting data

Hi ken

Thanks for your reply.

But I am not quite able to figure out how to use HTML::TableExtract to get the table cells as HTML::Element objects.

I am giving a very simple html table below, using the code I have already given above, can you please show me how can I use HTML::Element and get the attributes.

Assume that the page contains the following table :

<html> <title>Example table </title> <head> MyTable</head><br><br> <body> <table border border ="1"> <tr> <td><FONT COLOR = "green">ID</td> <td> <FONT COLOR = "blue">NAME</td> <td> <FONT COLOR = "RED">DOB</td> </tr> <tr> <td>1</td> <td>XYZ</td> <td>1-1-2000</td> </tr> <tr> <td>2</td> <td>PQR</td> <td>1-11-2000</td> </tr> </table> </body> </html>

Replies are listed 'Best First'.
Re^3: How to restore the colors of a webpage when extracting data
by kcott (Archbishop) on Jul 17, 2013 at 09:09 UTC
    "But I am not quite able to figure out how to use HTML::TableExtract to get the table cells as HTML::Element objects."

    Really? It's mentioned repeatedly thoughout the HTML::TableExtract documentation (a link I provided yesterday). Within that page, search for the string "HTML::Element" and read every section it appears in (which, by a very brief visual inspection, appears to be all of them except AUTHOR and COPYRIGHT).

    -- Ken

      Well, I was following the instructions in that HTML::TableExtract page. But was not getting anything for the $te->first_table_found call, hence the $table variable was having undefined object and as a result the rest of the code did not run.
      Would be helpful if you can point out my mistakes.