Extract a particular table from multi-table html file using perl [closed]

为君一笑 提交于 2019-12-02 13:30:12

A good module for extracting parts of a HTML document is HTML::Query.

It provides a jQuery-like interface for selecting what part of a document to extract.

You can do this using known Perl modules like :

  • LWP
  • WWW::Mechanize
  • HTML::TreeBuilder
  • HTML::TreeBuilder::XPath

All are on http://search.cpan.org

The last Perl module is really usefull, you can use Xpath expressions like :

//table[0]/tr[3]/td[2]/text()

by example, to print the text of the second td element in the third tr from the first table.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!