private function getName($string)
{
$name = preg_replace("/[^a-z0-9]/ui", '_', $string);
if (null === $name) {
throw new RuntimeException(sprintf('Encoding error, only US-ASCII and UTF-8 supported, can not process %s', var_export($string, true)));
}
try {
new DOMElement("{$name}");
} catch (DOMException $e) {
throw new DOMException(sprintf('Invalid name %s', var_export($name, true)));
}
return $name;
}