private function element($name, $value = null, $attributes = array())
{
$element = $this->document->createElement($name);
if (is_null($value) === false) {
$text = $this->document->createTextNode($value);
$element->appendChild($text);
}
foreach ($attributes as $key => $val) {
$element->setAttribute($key, $val);
}
return $element;
}