<div id="xxoo" class="pagelist">
<span> 159条 共8页</span>
<strong>1</strong>
<a href="/zhaoyangjian724/article/category/1756685/2">2</a>
<a href="/zhaoyangjian724/article/category/1756685/3">3</a>
<a href="/zhaoyangjian724/article/category/1756685/4">4</a>
<a href="/zhaoyangjian724/article/category/1756685/5">5</a>
<a href="/zhaoyangjian724/article/category/1756685/6">...</a>
<a href="/zhaoyangjian724/article/category/1756685/2">下一页</a>
<a href="/zhaoyangjian724/article/category/1756685/8">尾页</a>
</div>
</div>
#my @type=$tree->findvalues( '/html/body');
my @type=$tree->findvalues( '/html/body//div[@id="xxoo"]/span');
print @type;
node2:/root/pachong#perl t1.pl
159条 共8页node2:/root/pachong#
查看div标签下的span标签的内容
#my @type=$tree->findvalues( '/html/body');
my @type=$tree->findvalues( '/html/body//div[@class="pagelist"]/a');
print @type;
node2:/root/pachong#perl t1.pl
2345...下一页尾页node2:/root/pachong#
查看div标签下的a标签的数组
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse_file( "test.html");
##获取博客分类的URL,根据a标签查找
#my @type=$tree->findvalues( '/html/body');
my @type=$tree->findvalues( '/html/body//div[@id="xxoo"]/a');
print @type;
node2:/root/pachong#perl t1.pl
2345...下一页尾页node2:/root/pachong#