zoukankan      html  css  js  c++  java
  • 根据body的内容 查找h2标签的@class="subtitle"的值

    <pre name="code" class="html"><body class="api jquery listing">
    
    <div id="container">
            <div id="content-wrapper" class="clearfix row">
    
    
    <div class="content-right twelve columns">
            <div id="content">
    
                    <div class="container fl">
                     <h1 class="title">产品公告查询接口管理</h1>
    
                    <!-- api start -->
                                      <h2 class="subtitle" id="getInfo">查询产品公告详情</h2>
    
    根据body的内容 查找h2标签的@class="subtitle"的值
    
    jrhmpt01:/root# cat yy1.pl 
    use  LWP::UserAgent;
    use DBI;  
    use POSIX;
    use Data::Dumper;
    use HTML::TreeBuilder;
    my $ua = LWP::UserAgent->new;
    $ua->timeout(10);
    $ua->env_proxy;
    $ua->agent("Mozilla/8.0");
      use HTML::TreeBuilder::XPath;
       $tree= HTML::TreeBuilder::XPath->new;
      $tree->parse_file( "ProductForcastController.html");
    my @title=  $tree->findvalues('/html/body//h2[@class="subtitle"]');
    print "@title is @title
    "
    jrhmpt01:/root# perl yy1.pl 
    @title is 查询产品公告详情 查询产品公告


    
                                        
    
  • 相关阅读:
    avcodec_open2()分析
    CentOS 6.9 下安装DB2
    使用python操作mysql数据库
    python之tcp自动重连
    决策树算法
    文件夹自动同步工具
    KNN算法介绍
    go语言生成uuid
    golang之log rotate
    golang之tcp自动重连
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350119.html
Copyright © 2011-2022 走看看