/** * @param Element $element * @return \DOMElement */ protected function createElement(Element $element) { $dom = $this->doc->createElement($element->getName(), $element->getValue()); foreach ($element->getAttributes() as $attribute) { $dom->setAttribute($attribute->getName(), $attribute->getValue()); } foreach ($element->getChildren() as $child) { $child = $this->createElement($child); $dom->appendChild($child); } return $this->doc->appendChild($dom); }