public function copyAttributesFrom(SimpleXMLElement $src, $overwrite = true)
    {
        $dom = dom_import_simplexml($this);

        foreach (dom_import_simplexml($src)->attributes as $attr) {
            if ($overwrite
                || !$dom->hasAttributeNS($attr->namespaceURI, $attr->nodeName)
            ) {
                $dom->setAttributeNS($attr->namespaceURI, $attr->nodeName, $attr->nodeValue);
            }
        }

        return $this;
    }