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

        $document  = '<!DOCTYPE html>' . PHP_EOL;
        $document .= '<html><head>' . PHP_EOL;
        $document .= '<meta charset="' . $charset . '">' . PHP_EOL;
        $document .= '<title>Validation document</title>' . PHP_EOL;
        $document .= '</head><body>' . $nodes . '</body></html>';

        return $document;
    }