generateXML() public method

Generate the XML for a given element / sub-element.
public generateXML ( XMLWriter $XMLWriter ) : void
$XMLWriter XMLWriter
return void
Example #1
0
 /**
  * @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));
 }
Example #2
0
 /**
  * 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));
 }