openMemory(); $this->setIndent(true); $this->setIndentString(' '); $this->startDocument('1.0', 'utf-8'); $this->writeAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9'); $this->writeAttribute('standalone', 'yes'); $this->startElement('data'); } public function addRow($year, $imgUrlm, $imgUrl, $txt) { $this->startElement('images'); $this->writeAttribute('year', $year); $this->writeAttribute('imgUrlm', $imgUrlm); $this->writeAttribute('imgUrl', $imgUrl); $this->writeElement('txt', $txt); $this->endElement(); } public function getDocument() { $this->endElement(); $this->endDocument(); return $this->outputMemory(); } public function output() { header('Content-type: text/xml'); echo $this->getDocument(); } }