query = $query; } /** * Test for the presence of an element of given name * * @param DOMElement $template node * @param Tag $tag Tag this template belongs to * @return void */ public function check(DOMElement $template, Tag $tag) { $xpath = new DOMXPath($template->ownerDocument); foreach ($xpath->query($this->query) as $node) { throw new UnsafeTemplateException("Node '" . $node->nodeName . "' is disallowed because it matches '" . $this->query . "'", $node); } } }