[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/XmlRpc/Generator/ -> XmlWriter.php (source)

   1  <?php
   2  /**
   3   * Zend Framework
   4   *
   5   * LICENSE
   6   *
   7   * This source file is subject to the new BSD license that is bundled
   8   * with this package in the file LICENSE.txt.
   9   * It is also available through the world-wide-web at this URL:
  10   * http://framework.zend.com/license/new-bsd
  11   * If you did not receive a copy of the license and are unable to
  12   * obtain it through the world-wide-web, please send an email
  13   * to [email protected] so we can send you a copy immediately.
  14   *
  15   * @category   Zend
  16   * @package    Zend_XmlRpc
  17   * @subpackage Generator
  18   * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  19   * @license    http://framework.zend.com/license/new-bsd     New BSD License
  20   * @version    $Id$
  21   */
  22  
  23  /**
  24   * @var Zend_XmlRpc_Generator_GeneratorAbstract
  25   */
  26  require_once 'Zend/XmlRpc/Generator/GeneratorAbstract.php';
  27  
  28  /**
  29   * XML generator adapter based on XMLWriter
  30   */
  31  class Zend_XmlRpc_Generator_XmlWriter extends Zend_XmlRpc_Generator_GeneratorAbstract
  32  {
  33      /**
  34       * XMLWriter instance
  35       *
  36       * @var XMLWriter
  37       */
  38      protected $_xmlWriter;
  39  
  40      /**
  41       * Initialized XMLWriter instance
  42       *
  43       * @return void
  44       */
  45      protected function _init()
  46      {
  47          $this->_xmlWriter = new XMLWriter();
  48          $this->_xmlWriter->openMemory();
  49          $this->_xmlWriter->startDocument('1.0', $this->_encoding);
  50      }
  51  
  52  
  53      /**
  54       * Open a new XML element
  55       *
  56       * @param string $name XML element name
  57       * @return void
  58       */
  59      protected function _openElement($name)
  60      {
  61          $this->_xmlWriter->startElement($name);
  62      }
  63  
  64      /**
  65       * Write XML text data into the currently opened XML element
  66       *
  67       * @param string $text XML text data
  68       * @return void
  69       */
  70      protected function _writeTextData($text)
  71      {
  72          $this->_xmlWriter->text($text);
  73      }
  74  
  75      /**
  76       * Close an previously opened XML element
  77       *
  78       * @param string $name
  79       * @return void
  80       */
  81      protected function _closeElement($name)
  82      {
  83          $this->_xmlWriter->endElement();
  84  
  85          return $this;
  86      }
  87  
  88      public function saveXml()
  89      {
  90          return $this->_xmlWriter->flush(false);
  91      }
  92  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1