public function XMLSitemapWriter::writeElement in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.xmlsitemap.inc \XMLSitemapWriter::writeElement()
Write full element tag including support for nested elements.
@todo Missing a return value since XMLWriter::writeElement() has one.
Parameters
string $name: The element name.
string|array $content: The element contents or an array of the elements' sub-elements.
1 call to XMLSitemapWriter::writeElement()
- XMLSitemapWriter::writeSitemapElement in ./
xmlsitemap.xmlsitemap.inc - Write an full XML sitemap element tag.
File
- ./
xmlsitemap.xmlsitemap.inc, line 143 - XML sitemap integration functions for xmlsitemap.module.
Class
- XMLSitemapWriter
- Extended class for writing XML sitemap files.
Code
public function writeElement($name, $content = NULL) {
if (is_array($content)) {
$this
->startElement($name);
$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 {
parent::writeElement($name, check_plain((string) $content));
}
}