<pre name="code" class="python"> find_by_tag_name: @elements = $h->find_by_tag_name('tag', ...); $first_match = $h->find_by_tag_name('tag', ...); 在列表环境,返回一个元素列表或者在$h下有很多指定tag名字的。 在标量上下文, 返回第一个(以先前的顺序遍历树) <span class="link_view" title="阅读次数"><a href="/zhaoyangjian724/article/details/50749020" title="阅读次数">阅读</a>(5)</span> #<a> 标签的 href 属性用于指定超链接目标的 URL。 href 属性的值可以是任何有效文档的相对或绝对 URL,包括片段标识符和 JavaScript 代码段。如果用户选择了 <a> 标签中的内容,那么浏览器会尝试检索并显示 href 属性指定的 URL 所表示的文档,或者执行 JavaScript 表达式、方法和函数的列表。 @Links = $tree->find_by_tag_name('a'); foreach (@Links) { @href = $_->attr('href'); foreach (@href) { if($_=~ /.*category.*/) { push( @category, $_ ); } } } 根据a标签,href 是a标签的一个属性 数据格式: <div id="article_content" class="article_content">^M ^M <p>什么时候会产生实例恢复呢?当你数据库服务器异常断电,重启数据库就会发生实例恢复。实例恢复是由数据库自动完成的,无须DBA的干涉。当然这里有个前提条件:数据文件、</p>^M <p>在线日志文件、控制文件不得有损坏。</p>^M <p> 我们用实验来分析一下实例恢复的整个过程吧!</p>^M <p>1、在关闭数据库前,我们先看一下几个检查点的SCN<br>^M --System checkpoint SCN (存在于控制文件)</p>^M <p>SQL> select checkpoint_change# from v$database; </p>^M <p>CHECKPOINT_CHANGE#<br>^M ------------------<br>^M 1. name :指定标签的名称。 2. id :指定标签的唯一标识。 3. class :指定标签的类名。 use HTML::TreeBuilder::XPath; my $tree= HTML::TreeBuilder::XPath->new; $tree->parse_file( 'dump 验证实例恢复的起点和终点 .html'); #获取每个版块的页码数 my $pageString; ##根据div标签,查找@id属性的列表 @pageString = $tree->findvalues('/html/body//div[@id="article_content"]'); foreach (@pageString){print " $_ "; }; findvalues: 返回匹配节点的值作为列表,这主要是和findnodes_as_strings一样,除了列表的元素是对象a