我有一个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