private function appendChildNodes(\DOMElement $target, \DOMElement $source, $addNameAttribute = FALSE) { $xpath = new Xpath($source->ownerDocument); /** @var \DOMElement $child */ foreach ($xpath('*', $source) as $child) { $this->addNode($target, $child, $addNameAttribute); } }