XPath PHP example

         $xp = new domxpath($dom);
         $result = $xp->query("/html/head/title");
         print $result[0]->firstChild->data;
With context-node:
         $xp = new domxpath($dom);
         $result = $xp->query("./head/title",$dom->documentElement);
         print $result[0]->firstChild->data;
Produces the same Output.
 
© copyright 2004 Bitflux GmbH