【发布时间】:2014-03-27 13:54:54
【问题描述】:
我正在从另一个网站取消工作。源网站有不同的情况,因为用户复制粘贴数据和结构更改。
案例一:
<h3>Job Description</h3>
<div style="text-align: justify; line-height: 115%"><b>
Receptionist is assigned for ANAFAE-ALC based in Mazar-e-Sharif. This position is supervised by and reports to ALC Educational Program Manager and following are the main duties but are not limited to that.</div>
案例 2:
<h3>Job Description</h3>
<p>
Receptionist is assigned for ANAFAE-ALC based in Mazar-e-Sharif. This position is supervised by and reports to ALC Educational Program Manager and following are the main duties but are not limited to that.</p>
在这种情况下,p 标签有时会替换其他 html 标签。
案例 3:
<h3>Job Description</h3>
Receptionist is assigned for ANAFAE-ALC based in Mazar-e-Sharif. This position is supervised by and reports to ALC Educational Program Manager and following are the main duties but are not limited to that.
我正在使用这个字符串来获取内容。这现在适用于案例 3,但不适用于其他两种情况。如何修复 t 以适用于所有三种情况。
//text()[preceding::h3[text()="Job Description"]
【问题讨论】:
标签: php xpath web-scraping