/** * Joins this XPath expression with $other (another XPath expression) using * $combiner to join them. * * @param string $combiner The combiner string. * @param XPathExpr $other The other XPath expression to combine with * this one. */ public function join($combiner, $other) { $prefix = (string) $this; $prefix .= $combiner; $path = $other->getPrefix() . $other->getPath(); /* We don't need a star prefix if we are joining to this other prefix; so we'll get rid of it */ if ($other->hasStarPrefix() && '*/' == $path) { $path = ''; } $this->prefix = $prefix; $this->path = $path; $this->element = $other->getElement(); $this->condition = $other->GetCondition(); }
/** * Sets the XPath expression to be only of type. * * @param XPathExpr $xpath The XPath expression * * @return XPathExpr The modified expression * * @throws ParseException Because *:only-of-type is not implemented */ protected function xpath_only_of_type($xpath) { if ($xpath->getElement() == '*') { throw new ParseException('*:only-of-type is not implemented'); } $xpath->addCondition('last() = 1'); return $xpath; }
/** * undocumented function * * @param XPathExpr $xpath * @param XPathExpr $expr * * @return XPathExpr * * @throws ParseException */ protected function _xpath_nth_of_type($xpath, $expr) { if ($xpath->getElement() == '*') { throw new Exception('*:nth-of-type() is not implemented'); } return $this->_xpath_nth_child($xpath, $expr, false, false); }