/** * @param \DOMDocumentFragment $target * @param \DOMNode $node */ private static function add($target, $node) { if ($node instanceof \DOMDocument) { if ($node->documentElement instanceof \DOMElement) { $target->appendChild($target->ownerDocument->importNode($node->documentElement, TRUE)); } } elseif ($node->ownerDocument !== $target->ownerDocument) { $target->appendChild($target->ownerDocument->importNode($node, TRUE)); } else { $target->appendChild($node->cloneNode(TRUE)); } }
/** * build out a product link subtree * * @param DOMDocumentFragment $frag * @param string $type * @param int $position * @param DOMNode $value * @return DOMDocumentFragment */ protected function _addProductLink(DOMDocumentFragment $frag, $type, $position, DOMNode $value) { $frag->appendChild($frag->ownerDocument->createElement('ProductLink'))->addAttributes(array('link_type' => $type, 'operation_type' => 'Add', 'position' => $position))->createChild('LinkToUniqueID')->appendChild($value); return $frag; }
public function setRoot(dom\element $node) { return parent::appendChild($node); }