public function theXmlElementShouldExist($element) { $elements = $this->getDom()->xpath($element); if ($elements->length == 0) { throw new \Exception("The element '{$element}' does not exist."); } return $elements; }