【发布时间】:2011-09-11 09:05:18
【问题描述】:
有没有办法使用HTML::TableExtract从 HTML 表中删除整行(html 标记全部)?
使用来自 CPAN 的示例代码,这是我迄今为止尝试过的:
使用 HTML::TableExtract qw(tree); 我的 $te = HTML::TableExtract->new( headers => [qw(name type members)] ); # 从文件中获取 $html_string... $te->parse($html_string); 我的 $table = $te->first_table_found(); 我的 $table_tree = $table->tree; $table_tree->row(4)->replace_content(''); 我的 $document_tree = $te->tree; 我的 $document_html = $document_tree->as_HTML; # 将 $document_html 写入文件 ...现在,顾名思义,$table_tree->row(4)->replace_content(''); 行中的“replace_content()”删除了第 4 行的 content,但该行本身仍保留在标记中。我还需要删除标签和中间的所有内容。
有什么想法吗?
【问题讨论】:
标签: html perl html-table