3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\XmlRpc\Generator
;
13 * XML generator adapter based on XMLWriter
15 class XmlWriter
extends AbstractGenerator
25 * Initialized XMLWriter instance
29 protected function _init()
31 $this->xmlWriter
= new \
XMLWriter();
32 $this->xmlWriter
->openMemory();
33 $this->xmlWriter
->startDocument('1.0', $this->encoding
);
38 * Open a new XML element
40 * @param string $name XML element name
43 protected function _openElement($name)
45 $this->xmlWriter
->startElement($name);
49 * Write XML text data into the currently opened XML element
51 * @param string $text XML text data
54 protected function _writeTextData($text)
56 $this->xmlWriter
->text($text);
60 * Close an previously opened XML element
65 protected function _closeElement($name)
67 $this->xmlWriter
->endElement();
77 public function saveXml()
79 return $this->xmlWriter
->flush(false);