Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/XmlRpc/Generator/GeneratorAbstract.php
Go to the documentation of this file.
00001 <?php
00026 abstract class Zend_XmlRpc_Generator_GeneratorAbstract
00027 {
00033     protected $_encoding;
00034 
00040     public function __construct($encoding = 'UTF-8')
00041     {
00042         $this->_encoding = $encoding;
00043         $this->_init();
00044     }
00045 
00055     public function openElement($name, $value = null)
00056     {
00057         $this->_openElement($name);
00058         if ($value !== null) {
00059             $this->_writeTextData($value);
00060         }
00061 
00062         return $this;
00063     }
00064 
00073     public function closeElement($name)
00074     {
00075         $this->_closeElement($name);
00076 
00077         return $this;
00078     }
00079 
00085     abstract public function saveXml();
00086 
00092     public function getEncoding()
00093     {
00094         return $this->_encoding;
00095     }
00096 
00102     public function flush()
00103     {
00104         $xml = $this->saveXml();
00105         $this->_init();
00106         return $xml;
00107     }
00108 
00114     public function __toString()
00115     {
00116         return $this->stripDeclaration($this->saveXml());
00117     }
00118 
00125     public function stripDeclaration($xml)
00126     {
00127         return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $xml);
00128     }
00129 
00135     abstract protected function _openElement($name);
00136 
00142     abstract protected function _writeTextData($text);
00143 
00149     abstract protected function _closeElement($name);
00150 }
 All Data Structures Namespaces Files Functions Variables Enumerations