Example #1
0
 protected function getForeignAttributes(dom\element $source, dom\element $target = null, $bRemove = false)
 {
     $aResult = array();
     foreach ($source->getAttributes() as $attr) {
         $sNamespace = $attr->getNamespace();
         if (!$sNamespace || $sNamespace == $this->getNamespace()) {
             if ($target) {
                 $target->add($this->parseAttribute($attr));
             }
         } else {
             if ($sNamespace !== self::BUILDER_NS) {
                 $aResult[$sNamespace] = true;
                 if ($bRemove) {
                     $attr->remove();
                 }
             }
         }
     }
     return $aResult;
 }
Example #2
0
 protected function mergeElementComplex(dom\element $current, dom\element $import)
 {
     foreach ($import->getChildren() as $child) {
         if ($child->getNamespace() === $this->getNamespace('self')) {
             continue;
         } else {
             if ($el = $current->getx("{$child->getName()}", array(), false)) {
                 $this->mergeElement($el, $child);
             }
         }
     }
     foreach ($current->getChildren() as $child) {
         $import->add($child);
     }
     return $current->replace($import);
 }