/** * @param OutputInterface $collection * * @return string */ public function getOutput(OutputInterface $collection) { $xmlWriter = new XMLWriter(); $xmlWriter->openMemory(); $xmlWriter->startDocument('1.0', 'UTF-8'); $xmlWriter->setIndent($this->isIndented()); $xmlWriter->setIndentString($this->getIndentString()); $collection->generateXML($xmlWriter); return trim($xmlWriter->flush(true)); }
/** * Renders the Sitemap as an XML string. * * @param OutputInterface $collection * * @return string */ public function getOutput(OutputInterface $collection) { $xmlWriter = new XMLWriter(); $xmlWriter->openMemory(); $xmlWriter->setIndent($this->isIndented()); $xmlWriter->startDocument('1.0', 'UTF-8'); foreach ($this->processingInstructions as $target => $content) { $xmlWriter->writePi($target, $content); } $xmlWriter->setIndentString($this->getIndentString()); $collection->generateXML($xmlWriter); return trim($xmlWriter->flush(true)); }