我有一個HTML文件,並希望找到第二TH內容的「Stn代碼」和第三TH內容的「路線號」表(多)之間。在php中獲取這個特定表格的XPATH表達式是什麼:這是什麼XPATH表達式
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr class="heading_table_top">
<th width="6%">SNo</th>
<th width="9%">Stn Code</th>
<th width="17%">Stn Name</th>
<th width="9%">Route No.</th>
<th width="9%">Arrival Time</th>
<th width="9%">Dep. Time</th>
<th width="15%">Halt Time (In Minutes)</th>
<th width="9%">Distance</th>
<th width="6%">Day</th>
<th width="20%">Remark</th>
............................. .....
謝謝,但在我的網頁,該表在許多表包裹和所有人都被退回。我只想要一個帶有這個文本的直系後裔 – user774250 2012-03-15 18:24:47
這看起來工作:$ dom_xpath->查詢('//表// // tr [th [2] =「Stn代碼」和th [4] =「路由號」和th [7] =「暫停時間(分鐘)「]/parent :: *'); – user774250 2012-03-15 18:36:48
@ user774250嘗試'// table [tbody/tr/th [2] ='Stn Code'and tbody/tr/th [4] ='Route No。'] – Gordon 2012-03-15 20:45:17