PHPWord DOMDocument::loadXML(): Несоответствие открывающего и конечного тегов: br строка 1 и p в Entity, строка: 1

В чем проблема с моим HTML, почему он не принят? Вот мой HTML, я использую PHPWord для преобразования html в doc, но получаю сообщение об ошибке ниже.

PHPWord DOMDocument::loadXML(): Opening and ending tag mismatch: br line 1 and p in Entity, line: 1

<div id="reportcontrol" class="company_products_and_operations_report">
    <div class="predetail-header">
        <div class="print-option">
            <span class="action-print" title="Print (âP)" data-type="print">
                <i class="print-report"></i>
            </span>
        </div>
        <h2 class="report-title" style="border: none; float: none; margin-top: 5px;">Products & Operations</h2>
        <p></p>
        <table style="width: 222px; height: 538px;" class="report-table default-grid">
            <tbody>
                <tr>
                    <th colspan="2" class="TableHead"> 2015 Stores</th>
                </tr>
                <tr>
                    <th class="ProfileIndent0">State</th>
                    <th class="ProfileHead">No of Stores </th>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> California</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">62</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Texas</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">34</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Florida</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">20</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Ohio</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">8</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Arizona</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">6</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Colorado</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">5</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Nevada</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">5</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Virginia</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">4</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Washington</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">4</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Maryland</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">3</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Oklahoma</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">3</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Oregon</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">3</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Arkansas</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">2</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Indiana</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">2</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Kentucky</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">2</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Louisiana</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">2</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> New Mexico</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">2</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Alabama</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">1</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Kansas</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">1</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> New York</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">1</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Pennsylvania</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">1</td>
                </tr>
                <tr>
                    <th class="ProfileIndent0"> Tennessee</th>
                    <td style="border-right: 1px solid rgb(221, 221, 221);">1</td>
                </tr>
                <tr>
                    <th class="ProfileTotal">Total</th>
                    <td class="ProfileDataTotal" style="border-right: 1px solid rgb(221, 221, 221);">172</td>
                </tr>
            </tbody>
        </table>
        <h3>Restaurant Brands</h3>
        <ul class="prodoplist">
            <li>BJ's Restaurant & Brewery</li>
            <li>BJ's Restaurant & Brewhouse</li>
            <li>BJ's Pizza & Grill</li>
            <li>BJ's Grill</li>
        </ul>
        <p>
            <strong>Selected Menu Items</strong>
            <br>Shareable Appetizers
                <br>BJ's Snacks & Small Bites
                    <br>Lunch Specials
                        <br>Sandwiches and Tacos
                            <br>Handcrafted Burgers
                                <br>Housemade Soups & Salads
                                    <br>Starter Salads
                                        <br>Garden Fresh Specialty Salads
                                            <br>Beverages
                                                <br>Handcrafted Beers
                                                    <br>Cocktails and Wine
                                                        <br>Pizza
                                                            <br>Pasta favorites
                                                            </p>
                                                        </div>
                                                    </div>

Как это недействительный HTML при преобразовании в Doc?

Вот документ phpword

$phpWord = new \PhpOffice\PhpWord\PhpWord();
        $phpWord->setDefaultFontSize(10);
        $phpWord->setDefaultFontName('Calibri');
        $phpWord->setDefaultParagraphStyle(
            array(
            'spaceAfter' => \PhpOffice\PhpWord\Shared\Converter::pointToTwip(0))
        );
$section = $phpWord->addSection();
\PhpOffice\PhpWord\Shared\Html::addHtml($section, $html, false, false);

Может ли кто-нибудь помочь мне определить, что вызывает ошибку,

Не обращайте внимания на этот текст ниже: Что такое Lorem Ipsum Lorem Ipsum — это просто фиктивный текст в индустрии печати и набора текста Lorem Ipsum был стандартным фиктивным текстом в отрасли с 1500-х годов, когда неизвестный печатник взял гранку шрифта и зашифровал ее, чтобы создать шрифт. образец книги у него есть?


person apelidoko    schedule 15.12.2020    source источник


Ответы (1)


Пожалуйста, проверьте переменную $html. В html есть апостроф. Если вы используете полный html как строку.

person kishor koshti    schedule 16.12.2020