开发者

xPath query problem

In a previous question, user helped me but i'm stuck of doing simple request :

<?php $nodes = $xPath->query('//table[@class="some_class"]');

But it returns me the whole table datas instead of rows of the table, that's why i want to retrive only "td" of the table.

I tryed (but it's n开发者_StackOverflow社区ot working)

 <?php $nodes = $xPath->query('//table[@class="some_class"]/tbody/tr');

What am I doing wrong please ?

*EDIT HTML structure *

<table class="some_class">
<tbody><tr>
<td class="firstcol" width="160">name</td>
<td width="250">Some&nbsp;Data</td>
</tr>


//table[@class='some_class']//td

Added a middle // in there because of my mistrust at any level of tbody's actually being there (although for DOM they should be).


Assuming that the path matches correctly, you may just need to append /* to match all child nodes:

//table[@class="some_class"]/tbody/tr/*

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜