public function replaceSelf(SimpleXMLElement $new)
    {
        $old = dom_import_simplexml($this);
        $new = $old->ownerDocument->importNode(dom_import_simplexml($new), true);

        $node = $old->parentNode->replaceChild($new, $old);
        return simplexml_import_dom($node, get_class($this));
    }