下面的代码显示 TreeBuilder 方法look_down 找不到“section”元素。为什么?
use strict;
use warnings;
use HTML::TreeBuilder;
my $html =<<'END_HTML';
<html>
<head><title></title></head>
<body>
<div attrname="div">
<section attrname="section">
</section>
</div>
</body>
</html>
END_HTML
my $tree = HTML::TreeBuilder->new_from_content($html);
my @divs = $tree->look_down('attrname', 'div');
print "number of div elements found = ", scalar(@divs), "\n";
my @sections = $tree->look_down('attrname', 'section');
print "number of section elements found = ", scalar(@sections), "\n";
$tree->delete();
输出:找到的 div 元素数 = 1 找到的部分元素数 = 0