Hello Monks,

I'm using HTML::TableExtract in the effort to grab data out of specific cells on an HTML table. However, HTML::TableExtract only seems to spit back raw text of cells, and thus does not give me any ability to parse information using HTML inside the cell (i.e. list items).

Supposedly one can set a "decode" parameter to false when instantiating the TableExtracter, however this does not change a thing. The module still spits back (strangely concatenated) plain text from inside the cells.

So I went into the code of the TableExtract module and found the reason why - namely that the parameter controls a switch in the "text" event handler that to either decode or not touch the text it received before it bubbles up to output. However, debugging the code, I found that the text event handler already receives plain HTML-stripped text, so this switch make no difference on whether you receive plain text or HTML in the end.

Now my understanding of the HTML::Parser module (which TableExtract subclasses) is not sufficient to find out where I could find or pick up those tags before they get stripped from the text. I suppose it will require some modification of the TableExtract module. Has anybody examined the innards of this module or has a good understanding of the HTML::Parser and can give me a clue on what to try next?

Thanks -
M_ski


In reply to Parsing Cell Contents of Extracted HTML Tables by imielins

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.