in reply to need help to extract table form html
For example:
This simple example will output much more readable text with all of the relevant information contained within. For a good tutorial see O'Reilly's book on the subject. Also see here for a great tutorial about thinking of HTML as a tree structure.use HTML::TreeBuilder; #Parse html content using html-treebuilder: my $root = HTML::TreeBuilder->new(); $root->parse($html); #from LWP content() $root->eof(); my @tables = $root->look_down(_tag => 'table'); while (@tables) { my $node = shift @tables; if (ref $node) { unshift @tables, $node->content_list; } else { print $node."\n"; } } $root = $root->delete;
|
|---|