Forum Moderators: coopster

Message Too Old, No Replies

domxpath help?

Can't seem to access domxpath

         

erikcw

4:39 pm on Feb 27, 2007 (gmt 0)

10+ Year Member



Hi all,

I'm trying to use php5's domxpath.


$dom = new domdocument;
@$dom->loadHTML($reply);

$xpath = new domxpath($dom);
$xpath->query('/html/body/form/center/table[2]/tbody/tr[3]/td/font');
for($i=0; $i<$xNodes->length; $i=$i+2)
{
$output .= "\n" . $xNodes->item($i+1)->nodeValue . ' ' . $xNodes->item($i)->nodeValue;
print $xNodes->previousSibling->nodeValue;
}

Problem is, I can't seem to get the "innerHTML" of the xpath. Is there some sort of xpath function that will let me do something like print_r() or var_dump() and get the values of the selected node. It can be php, or a firefox extension - I just need help learning to navigate with xpath.

Any ideas?

Thanks!
Erik

eelixduppy

11:40 pm on Feb 28, 2007 (gmt 0)



Would substringdata [us2.php.net] be something you are looking for? I'm not quite sure as I'm never done this with php before. Can you use javascript to accomplish what you want or does it have to be php? Sorry I cannot be of more help.

DOM Functions [us2.php.net]