前一个问题,用户帮我,但我坚持做简单的要求:的XPath查询问题
<?php $nodes = $xPath->query('//table[@class="some_class"]');
但它返回我的整个表DATAS而不是表行,这就是为什么我想仅检索表格的“td”。
我tryed(但它不工作)
<?php $nodes = $xPath->query('//table[@class="some_class"]/tbody/tr');
什么我做错了吗?
* 编辑HTML结构*
<table class="some_class">
<tbody><tr>
<td class="firstcol" width="160">name</td>
<td width="250">Some Data</td>
</tr>
请发布您正在使用的HTML,以便我们了解确切的结构。 – Oded 2010-09-30 19:10:58
没有输入样本,只能猜测......'// table [@ class =“some_class”] // td' – 2010-09-30 19:12:07
请确保在class属性中只有some_class而不是some_class和some_other_class。否则你将不得不使用'contains'功能。 – Gordon 2010-09-30 19:13:07