Commit 04bc0a9d authored by Dave Reid's avatar Dave Reid Committed by Dave Reid

Issue #2387557 by Dave Reid: Support more advanced XML element output using...

Issue #2387557 by Dave Reid: Support more advanced XML element output using format_xml_elements() within XMLSitemapWriter::writeElement().
parent 7b3522f6
......@@ -117,17 +117,20 @@ class XMLSitemapWriter extends XMLWriter {
/**
* Write full element tag including support for nested elements.
*
* @param $name
* @param string $name
* The element name.
* @param $content
* @param string|array $content
* The element contents or an array of the elements' sub-elements.
*
* @todo Missing a return value since XMLWriter::writeElement() has one.
*/
public function writeElement($name, $content = '') {
public function writeElement($name, $content = NULL) {
if (is_array($content)) {
$this->startElement($name);
foreach ($content as $sub_name => $sub_content) {
$this->writeElement($sub_name, $sub_content);
}
$xml_content = format_xml_elements($content);
// Remove additional spaces from the output.
$xml_content = str_replace(array(" <", ">\n"), array("<", ">"), $xml_content);
$this->writeRaw($xml_content);
$this->endElement();
}
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment