/** * Perform an xpath query and return only the 1st match * * @param String $q query string containing xpath * @param \DOMNode $ctx (optional) Context DOMNode * @param boolean $registerNodeNS Register flag pass thru * * @return fDOMNode */ public function queryOne($q, \DOMNode $ctx = NULL, $registerNodeNS = TRUE) { if (is_null($this->xp)) { $this->getDOMXPath(); } return $this->xp->queryOne($q, $ctx, $registerNodeNS); }
public function testQueryOneReturnsValueOnNonNodeQuery() { $this->assertEquals('1', $this->xp->queryOne('count(//root)')); }