protected function wrapInXmlDocument($nodes, $charset = null) {
        $charset = strtoupper($charset ?: Validator::CHARSET_UTF_8);

        $document  = '<?xml version="1.0" encoding="' . $charset . '"?>' . PHP_EOL;
        $document .= '<root>' . $nodes . '</root>';

        return $document;
    }