diff --git a/xmlsitemap.xmlsitemap.inc b/xmlsitemap.xmlsitemap.inc index 2a8ee92..5d4fadd 100644 --- a/xmlsitemap.xmlsitemap.inc +++ b/xmlsitemap.xmlsitemap.inc @@ -139,7 +139,7 @@ class XMLSitemapWriter extends XMLWriter { * * @todo Missing a return value since XMLWriter::writeElement() has one. */ - public function writeElement($name, $data = NULL) { + public function writeElement($name, $data = array()) { if (is_string($data)) { $data = array('content' => $data); } @@ -160,10 +160,9 @@ class XMLSitemapWriter extends XMLWriter { } else { $this->startElement($name); - $xml_content = format_xml_elements($data); - // Remove additional spaces from the output. - $xml_content = str_replace(array(" <", ">\n"), array("<", ">"), $xml_content); - $this->writeRaw($xml_content); + foreach ($data as $sub_name => $sub_content) { + $this->writeElement($sub_name, $sub_content); + } $this->endElement(); } }