/** * Retrieves a DOMElement which corresponds to this element and all * child properties. This is used to build an entry back into a DOM * and eventually XML text for application storage/persistence. * * @param DOMDocument $doc The DOMDocument used to construct DOMElements * @return DOMElement The DOMElement representing this element and all * child properties. */ public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) { $element = parent::getDOM($doc, $majorVersion, $minorVersion); if ($this->_login !== null) { $element->appendChild($this->_login->getDOM($element->ownerDocument)); } if ($this->_name !== null) { $element->appendChild($this->_name->getDOM($element->ownerDocument)); } if ($this->_quota !== null) { $element->appendChild($this->_quota->getDOM($element->ownerDocument)); } foreach ($this->_feedLink as $feedLink) { $element->appendChild($feedLink->getDOM($element->ownerDocument)); } return $element; }
/** * Creates individual Entry objects of the appropriate type and * stores them as members of this entry based upon DOM data. * * @param DOMNode $child The DOMNode to process */ protected function takeChildFromDOM($child) { $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; switch ($absoluteNodeName) { case $this->lookupNamespace('apps') . ':' . 'login'; $login = new Extension\Login(); $login->transferFromDOM($child); $this->_login = $login; break; case $this->lookupNamespace('apps') . ':' . 'name'; $name = new Extension\Name(); $name->transferFromDOM($child); $this->_name = $name; break; case $this->lookupNamespace('apps') . ':' . 'quota'; $quota = new Extension\Quota(); $quota->transferFromDOM($child); $this->_quota = $quota; break; case $this->lookupNamespace('gd') . ':' . 'feedLink'; $feedLink = new \Zend\GData\Extension\FeedLink(); $feedLink->transferFromDOM($child); $this->_feedLink[] = $feedLink; break; default: parent::takeChildFromDOM($child); break; } }
public function testExtensionAttributes() { $extensionAttributes = $this->theName->extensionAttributes; $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar'); $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab'); $this->theName->extensionAttributes = $extensionAttributes; $this->assertEquals('bar', $this->theName->extensionAttributes['foo1']['value']); $this->assertEquals('rab', $this->theName->extensionAttributes['foo2']['value']); $nameXml = $this->theName->saveXML(); $newName = new Extension\Name(); $newName->transferFromXML($nameXml); $this->assertEquals('bar', $newName->extensionAttributes['foo1']['value']); $this->assertEquals('rab', $newName->extensionAttributes['foo2']['value']); }