I found a nice function in XML_sql2xml. With it, you can get, easily, the result of a xpath expression.
function getXpathValues(&$dom, $expr) {
$xpth = $dom->xpath_new_context();
$xnode = xpath_eval($xpth,$expr);
if (isset ($xnode->nodeset[0])) {
$firstnode = $xnode->nodeset[0];
$children = $firstnode->children();
$value = $children[0]->content;
return $value;
}
else return Null;
}
Usage :
$dom = domxml_open_file('pear.rss');
echo $this->getXpathValues($dom, "//channel/title");