|
@@ -839,7 +839,8 @@ class Html2Text {
|
|
$html = mb_convert_encoding($html, "HTML-ENTITIES", "UTF-8");
|
|
$html = mb_convert_encoding($html, "HTML-ENTITIES", "UTF-8");
|
|
}
|
|
}
|
|
|
|
|
|
- $doc = static::getDocument($html, $options['ignore_errors']);
|
|
|
|
|
|
+ //$doc = static::getDocument($html, $options['ignore_errors']);
|
|
|
|
+ $doc = static::getDocument($html);
|
|
|
|
|
|
$output = static::iterateOverNode($doc, null, false, $is_office_document, $options);
|
|
$output = static::iterateOverNode($doc, null, false, $is_office_document, $options);
|
|
|
|
|
|
@@ -924,7 +925,7 @@ class Html2Text {
|
|
* @param boolean $ignore_error Ignore xml parsing errors
|
|
* @param boolean $ignore_error Ignore xml parsing errors
|
|
* @return \DOMDocument the parsed document tree
|
|
* @return \DOMDocument the parsed document tree
|
|
*/
|
|
*/
|
|
- static function getDocument($html, $ignore_error = false) {
|
|
|
|
|
|
+ static function getDocument($html, $ignore_error = true) {
|
|
|
|
|
|
$doc = new \DOMDocument();
|
|
$doc = new \DOMDocument();
|
|
|
|
|
|
@@ -947,9 +948,8 @@ class Html2Text {
|
|
if ($ignore_error) {
|
|
if ($ignore_error) {
|
|
$doc->strictErrorChecking = false;
|
|
$doc->strictErrorChecking = false;
|
|
$doc->recover = true;
|
|
$doc->recover = true;
|
|
- $doc->xmlStandalone = false;
|
|
|
|
|
|
+ $doc->xmlStandalone = true;
|
|
$old_internal_errors = libxml_use_internal_errors(true);
|
|
$old_internal_errors = libxml_use_internal_errors(true);
|
|
- //$load_result = $doc->loadHTML($html, LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NONET | LIBXML_PARSEHUGE);
|
|
|
|
$load_result = $doc->loadHTML($html, LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NONET | LIBXML_PARSEHUGE);
|
|
$load_result = $doc->loadHTML($html, LIBXML_NOWARNING | LIBXML_NOERROR | LIBXML_NONET | LIBXML_PARSEHUGE);
|
|
libxml_use_internal_errors($old_internal_errors);
|
|
libxml_use_internal_errors($old_internal_errors);
|
|
}
|
|
}
|