How to convert an HTML table to a fixed font text table?

I have an application in Perl that reads HTML-based and converts it to text output. One of the things I've come across is the need to easily convert an HTML table to a fixed font output.

<table border="1"> <tr><td>Hello</td> <td>World</td> <tr> <td>foo</td> <td>bar</td> </tr></table> 

I am looking for something that can take the above table and create something like the following.

  ------------------------------ | Hello | World | ------------------------------ | foo | bar | ------------------------------ 

I know how to approach this in Perl and write a process, but I hope there is some library that will already do this for me.

+6
html text perl
source share
2 answers

I used Text :: Table with great success. Combined with something like HTML :: TreeBuilder should be pretty easy.

+6
source share

If available, I would use an external program like lynx , links or w3m . I do not know if any of them can handle arbitrary HTML code added to them.

0
source share

All Articles