Source of file XmlWriter.php
Size: 1,681 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/XmlRpc/Generator/XmlWriter.php
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\XmlRpc\Generator; /** * XML generator adapter based on XMLWriter */ class XmlWriter extends AbstractGenerator { /** * XMLWriter instance * * @var XMLWriter */ protected $xmlWriter; /** * Initialized XMLWriter instance * * @return void */ protected function _init() { $this->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 a previously opened XML element * * @param string $name * @return XmlWriter */ protected function _closeElement($name) { $this->xmlWriter->endElement(); return $this; } /** * Emit XML document * * @return string */ public function saveXml() { return $this->xmlWriter->flush(false); } } |