public static function is_xml($string) {
        if (!defined('LIBXML_COMPACT')) {
            throw new \Exception('libxml is required to use Str::is_xml()');
        }

        $internal_errors = libxml_use_internal_errors();
        libxml_use_internal_errors(true);
        $result = simplexml_load_string($string) !== false;
        libxml_use_internal_errors($internal_errors);

        return $result;
    }