我從另一個網站上刪除工作。源網站與用戶複製粘貼數據和結構更改的情況不同。Xpath聯合多個查詢
情況1:
<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,但不適用於其他兩種情況。我如何解決所有三種情況。
//text()[preceding::h3[text()="Job Description"]
它不會返回任何東西。這是我現在擁有的完整字符串。//節點()[之前的兄弟姐妹:: * [1] [self :: h3 =「職位描述」]] /後代或自我::文本()和以下兄弟:: h3 [文本() =「工作要求」]]' – Taranum
XPath表達式的執行環境是什麼?你如何運行? – joemfb
這有效:'// node()[before :: h3 [node()=「Contact Information」]' – Taranum