public function formatted()
    {
        $doc = dom_import_simplexml($this->root)->ownerDocument;
        $doc->preserveWhiteSpace = false;
        $doc->formatOutput = true;
        $doc->encoding = 'UTF-8';

        return $doc->saveXML();
    }