Hi! we are working with PHPWord and we get this error
DOMDocument::loadXML(): Opening and ending tag mismatch: br line 1 and p in Entity, line: 1
in Html.php line 61
at HandleExceptions->handleError('2', 'DOMDocument::loadXML(): Opening and ending tag mismatch: br line 1 and p in Entity, line: 1', '/home/manuel/Dokumentujo/laravel/rubicon/vendor/phpoffice/phpword/src/PhpWord/Shared/Html.php', '61', array('element' => object(Section), 'html' => '
Se trata de seguros de baja prima creados para satisfacer la demanda del mercado y complementar las prestaciones existentes en los seguros de Viaje, Autos, Salud y Hogar.
El microseguro «Rehab Management», tiene como objetivo facilitar la rehabilitación médica, social y laboral después de un accidente a través de la figura del rehab manager. Ofrece protección integral al asegurado, con el apoyo y acompañamiento profesional y de calidad humana, asesoramiento en la resolución de las situaciones que vayan surgiendo después del accidente y una vez en el domicilio, ayuda en la recuperación de la independencia y mejoras en la calidad de vida.
How we could handle this?
Thanks for you help!
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Same Issue
Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: tr line 1 and table in Entity,
Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: table line 1 and div in Entity
Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: div line 1 and body in Entity
Warning: DOMDocument::loadXML(): Premature end of data in tag body line 1 in Entity
line: 1 in \src\PhpWord\Shared\Html.php on line 61
have you tried with <br/>?
you can try the below
$doc = new DOMDocument();
$doc->loadHTML($str);
$doc->saveHTML();
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $doc->saveHtml(),true);
Guys,
I am really wondering why you just don't use loadHTML instead of loadXML?
Since you're loading HTML?
I patched my local version, changed in public static function addHtml($element, $html, $fullHTML = false) (/PhpWord/Shared/Html.php)
and replaced it like below, it works perfectly
// $dom->loadXML($html);
$dom->loadHTML($html);
I also use to put this before:
libxml_use_internal_errors(true); //libxml_use_internal_errors — Disable libxml errors and allow user to fetch error information as needed
this has been modified in PR #1032
As commented there, this will mean dropping support for PHP 5.3, so it will be for a next iteration
I am using V0.15.0 and still getting the error! any effective workaround ?
Most helpful comment
I am using V0.15.0 and still getting the error! any effective workaround ?