_xmlWriter = new XMLWriter(); $this->_xmlWriter->openMemory(); $this->_xmlWriter->startDocument('1.0', $this->_encoding); } /** * Open a new XML element * * @param string $name XML element name * @return void */ protected function _openElement($name) { $this->_xmlWriter->startElement($name); } /** * Write XML text data into the currently opened XML element * * @param string $text XML text data * @return void */ protected function _writeTextData($text) { $this->_xmlWriter->text($text); } /** * Close an previously opened XML element * * @param string $name * @return void */ protected function _closeElement($name) { $this->_xmlWriter->endElement(); return $this; } public function saveXml() { return $this->_xmlWriter->flush(false); } }