protected function checkStart($type, $data, array $validParents)
{
$lastTag = end($this->stack);
if (!is_array($lastTag)) {
throw new Exceptions\OutputGeneratorException(sprintf('Invalid start: Trying to open outside of a document.'));
}
if (!in_array($lastTag[0], $validParents)) {
throw new Exceptions\OutputGeneratorException(sprintf('Invalid start: Trying to open %s inside %s, valid parent nodes are: %s.', $type, $lastTag[0], implode(', ', $validParents)));
}
$this->stack[] = array($type, $data, array());
}