protected function addAttributes(\stdClass $target, \DOMElement $node, Xpath $xpath) { foreach ($xpath->evaluate('@*', $node) as $attribute) { $target->{'@' . $attribute->name} = $attribute->value; } }