Example #1
0
 /**
  * Appends $source to current node
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $source
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function appendChild($source)
 {
     if (sizeof($source->children())) {
         /**
          * @see http://bugs.php.net/bug.php?id=41867 , fixed in 5.2.4
          */
         if (version_compare(phpversion(), '5.2.4', '<') === true) {
             $name = $source->children()->getName();
         } else {
             $name = $source->getName();
         }
         $child = $this->addChild($name);
     } else {
         $child = $this->addChild($source->getName(), $this->xmlentities($source));
     }
     $child->setParent($this);
     $attributes = $source->attributes();
     foreach ($attributes as $key => $value) {
         $child->addAttribute($key, $this->xmlAttribute($value));
     }
     foreach ($source->children() as $sourceChild) {
         $child->appendChild($sourceChild);
     }
     return $this;
 }
Example #2
0
 /**
  * Appends $source to current node
  *
  * @param Mage_XmlConnect_Model_Simplexml_Element $source
  * @return Mage_XmlConnect_Model_Simplexml_Element
  */
 public function appendChild($source)
 {
     if (sizeof($source->children())) {
         $name = $source->getName();
         $child = $this->addChild($name);
     } else {
         $child = $this->addChild($source->getName(), $this->xmlentities($source));
     }
     $child->setParent($this);
     $attributes = $source->attributes();
     foreach ($attributes as $key => $value) {
         $child->addAttribute($key, $this->xmlAttribute($value));
     }
     foreach ($source->children() as $sourceChild) {
         $child->appendChild($sourceChild);
     }
     return $this;
 }