public function render()
{
$xml = new SimpleXMLExtended('<' . $this->getRootElementName() . ' />');
foreach ($this->getRootElementAttributes() as $key => $value) {
$xml->addAttribute($key, $value);
}
if ($this->_config) {
$extends = $this->_config->getExtends();
$sectionName = $this->_config->getSectionName();
if (is_string($sectionName)) {
$child = $xml->addChild($sectionName);
$this->_addBranch($this->_config, $child, $xml);
} else {
foreach ($this->_config as $sectionName => $data) {
if (!$data instanceof \Zend_Config) {
$this->addChildConsiderCdata($xml, $sectionName, $data);
} else {
$child = $xml->addChild($sectionName);
if (isset($extends[$sectionName])) {
$child->addAttribute('zf:extends', $extends[$sectionName], \Zend_Config_Xml::XML_NAMESPACE);
}
$this->_addBranch($data, $child, $xml);
}
}
}
}
$dom = dom_import_simplexml($xml)->ownerDocument;
if ($encoding = $this->getEncoding()) {
$dom->encoding = $encoding;
}
$dom->formatOutput = $this->getFormatOutput();
$xmlString = $dom->saveXML();
return $xmlString;
}