protected function parseHTMLString($html)
    {
        $old_use_internal_errors = \libxml_use_internal_errors(TRUE);
        try {
            // Parse with DOMDocument and force to utf-8 character set, otherwise (valid) unclosed
            // HTML tags (eg <input>) cause parsing warnings. Unfortunately this means actual
            // invalid HTML is also accepted so very few parsing errors will be detected.
            $document = new \DOMDocument;
            $document->loadHTML(
                '<!DOCTYPE html><html>'
                .'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'
                .'<body>'.\trim($html).'</body>'
                .'</html>'
            );

            $table_elem = $document->getElementsByTagName('body')->item(0)->firstChild;
            $table      = \simplexml_import_dom($table_elem);
            if ($errors = \libxml_get_errors()) {
                $this->throwInvalidHTMLException($html, $errors);
            }
        } finally {
            \libxml_clear_errors();
            \libxml_use_internal_errors($old_use_internal_errors);

        }

        return $table;
    }
protected function parseHTMLString($html)
    {
        $old_use_internal_errors = \libxml_use_internal_errors(TRUE);
        try {
            // Parse with DOMDocument and force to utf-8 character set, otherwise (valid) unclosed
            // HTML tags (eg <input>) cause parsing warnings. Unfortunately this means actual
            // invalid HTML is also accepted so very few parsing errors will be detected.
            $document = new \DOMDocument;
            $document->loadHTML(
                '<!DOCTYPE html><html>'
                .'<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>'
                .'<body>'.\trim($html).'</body>'
                .'</html>'
            );

            $table_elem = $document->getElementsByTagName('body')->item(0)->firstChild;
            $table      = \simplexml_import_dom($table_elem);
            if ($errors = \libxml_get_errors()) {
                $this->throwInvalidHTMLException($html, $errors);
            }
        } finally {
            \libxml_clear_errors();
            \libxml_use_internal_errors($old_use_internal_errors);

        }

        return $table;
    }
@param string $html

@return \SimpleXMLElement