根据div 标签 查看数组@class=modulwrap 下面的/table/tbody/tr/td

时间:2023-03-09 05:24:27
根据div 标签 查看数组@class=modulwrap 下面的/table/tbody/tr/td
    <div class="modulwrap">
<div class="request_title">
<span class="request_sub_title">接口</span>
<div class="hrdiv">
<hr class="hr_line">
</div>
</div>
<table>
<tbody>
<tr>
<th width="25%" colspan="1"> 请求方法 </th>
<th width="40%"> 请求地址</th>
<th width="10%"> 版本号(apiver)</th>
<th width="25%"> 支持设备(platform)</th>
</tr>
<tr>
<td colspan="1"><strong>Get</strong> </td>
<td>/product/forcast/detail</td>
<td>1</td>
<td>支持所有设备</td>
</tr>
</tbody>
</table> 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;
my $tree= HTML::TreeBuilder::XPath->new;
$tree->parse_file( "ProductForcastController.html");
my @type=$tree->findvalues( '/html/body//div[@class="modulwrap"]/table/tbody/tr/td');
print "\@type is @type\n"; 根据div 标签 查看数组@class=modulwrap 下面的/table/tbody/tr/td jrhmpt01:/root# perl yy1.pl
@type is Level_3 Get /product/forcast/detail 1 支持所有设备 ProductForcastController getInfo 1 sn 否 公告编号 NOSET Integer 1 contractSymbol 否 产品标记 NOSET String 1 contractName 是 合约 名称 NOSET String 合约名称 1 contractSymbol 是 合约编号 NOSET String 合约编号 1 createTime 是 创建时间 NOSET Date 创建时间 1 fileName 是 文件名称 NOSET String 文件名称 1 fileNameList 是 上 传文件名列表 NOSET String 上传文件名列表 1 filePath 是 文件路径 NOSET String 文件路径 1 name 是 公告名称 NOSET String 公告名称 1 productName 是 产品名称 NOSET String 产品名称 1 productSymbol 是 交易代码 NOSET String 交易代码 1 sn 是 SN NOSET Integer SN 1 updateTime 是 最近修改时间 NOSET Date 最近修改时间 1 xh 是 序号 NOSET Integer 序号 Success {"data": {"contractName":"testString","contractSymbol":"testString","createTime":"2000-01-01 01:01:01","fileName":"testString","fileNameList":"testString","filePath":"testString","name":"testString","productName":"testString","productSymbol":"testString","sn":1,"updateTime":"2000-01-01 01:01:01","xh":1},"retCode":"0000","retMsg":"调用结果说明"} Level_3 Get /product/forcast/list 1 支持所有设备 ProductForcastController list 1 search 否 查询字段 NOSET String 查询字段 1 orderField 否 排序字段 NOSET String 排序字段 1 orderWay 否 排序方式 NOSET String 排序方式 1 pageNum 否 页码 NOSET Integer 页码 1 pageSize 否 每页显条数 NOSET Integer 每页显示条数 1 contractName 是 合 约名称 NOSET String 合约名称 1 contractSymbol 是 合约编号 NOSET String 合约编号 1 createTime 是 创建时间 NOSET Date 创建时间 1 fileName 是 文件名称 NOSET String 文件名称 1 fileNameList 是 上传文件名列表 NOSET String 上传文件名列表 1 filePath 是 文件路径 NOSET String 文件路径 1 name 是 公告名称 NOSET String 公告名称 1 productName 是 产品名称 NOSET String 产品名称 1 productSymbol 是 交易代码 NOSET String 交易代码 1 sn 是 SN NOSET Integer SN 1 updateTime 是 最近修改时间 NOSET Date 最近修改时间 1 xh 是 序号 NOSET Integer 序号 Success {"data": {"dataList":[{"contractName":"testString","contractSymbol":"testString","createTime":"2000-01-01 01:01:01","fileName":"testString","fileNameList":"testString","filePath":"testString","name":"testString","productName":"testString","productSymbol":"testString","sn":1,"updateTime":"2000-01-01 01:01:01","xh":1}],"pageNum":1,"pageSize":5,"realLine":1,"totalLine":2,"totalPage":2},"retCode":"0000","retMsg":"调用结果说明"}