Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / XmlRpc / Generator / DomDocument.php
blob0ef16dba1e2a065e033632574a0ffb6fd89b4103
1 <?php
2 /**
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
8 */
10 namespace Zend\XmlRpc\Generator;
12 /**
13 * DOMDocument based implementation of a XML/RPC generator
15 class DomDocument extends AbstractGenerator
17 /**
18 * @var \DOMDocument
20 protected $dom;
22 /**
23 * @var \DOMNode
25 protected $currentElement;
27 /**
28 * Start XML element
30 * @param string $name
31 * @return void
33 protected function _openElement($name)
35 $newElement = $this->dom->createElement($name);
37 $this->currentElement = $this->currentElement->appendChild($newElement);
40 /**
41 * Write XML text data into the currently opened XML element
43 * @param string $text
45 protected function _writeTextData($text)
47 $this->currentElement->appendChild($this->dom->createTextNode($text));
50 /**
51 * Close an previously opened XML element
53 * Resets $currentElement to the next parent node in the hierarchy
55 * @param string $name
56 * @return void
58 protected function _closeElement($name)
60 if (isset($this->currentElement->parentNode)) {
61 $this->currentElement = $this->currentElement->parentNode;
65 /**
66 * Save XML as a string
68 * @return string
70 public function saveXml()
72 return $this->dom->saveXml();
75 /**
76 * Initializes internal objects
78 * @return void
80 protected function _init()
82 $this->dom = new \DOMDocument('1.0', $this->encoding);
83 $this->currentElement = $this->dom;