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 查询产品公告详情 查询产品公告


    
       
    
    
  • 相关阅读:
    iOS -一些常用的方法
    handoff了解
    UIlabel
    扩展运行机制
    github -- fork提交项目
    iOS
    AppDelegate解析
    KVC
    KVO
    xcode升级后, 插件失效修复
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/6199069.html
Copyright © 2011-2022 走看看