Can't access nodes in xhtml document with multiple namespaces through xpath
===

Okay, so I'm trying to parse a xhtml site with curl and xpath. 

The site has multiple namespaces:

    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:addthis="http://www.addthis.com/help/api-spec"     xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml">

I am trying to get all the urls from the site's pagination like this:

    $url = [site_im_parsing];

    $dom = new DOMDocument();
    @$dom->loadHTML($url);	
    $xpath = new Domxpath($dom);
	
    $xpath->registerNamespace("x", "http://www.w3.org/1999/xhtml");
	
    $pages = $xpath->query('//x:div[2]/x:table/x:tbody/x:tr/x:td[1]/x:a');

    for ($i = 0; $i < $pages->length; $i++) {
		
        echo $pages->item($i)->getAttribute('href');
				   		
    }

This doesn't work. (The xpath to the pagination without the x-namespace should be right). Should I register all the namespaces and use them all somehow in the xpath query?

Best regards,
AB