Разбор XML-данных, имеющих значения HTML - PullRequest
0 голосов
/ 08 мая 2018

Hello

У меня есть конечная точка, которая возвращает данные XML, но с HTMl в качестве содержимого,

Пока использование simplexml_load_string($result, "SimpleXMLElement", LIBXML_NOCDATA); возвращает полосатую версию, т.е. все теги были удалены

Пример данных

<JUDGMENT>
    <summary>INTRODUCTION: <br />This appeal borders on the Law of Contract.<br /><br />FACTS: <br />From the statement of claim filed by the plaintiff (respondent) breach of contract and negligence were said to have been committed against it, by the appellant. Amongst other prayers, the respondent claimed:-<br />(a) one hundred million naira as general damages for malicious breach of contract and negligent conduct;<br />(b) sixty-four million, two hundred and fifty thousand, nine hundred and twenty naira as special damages;<br /></summary>
</JUDGMENT>

Разбор по моему методу

protected function scaffoldXML($result)
    {
        $xml = simplexml_load_string($result, "SimpleXMLElement", LIBXML_NOCDATA);
        return $json = json_encode($xml);
    }

Возвращает

"summary":"INTRODUCTION: This appeal borders on the Law of Contract.FACTS: From the statement of claim filed by the plaintiff (respondent) breach of contract and negligence were said to have been committed against it, by the appellant. Amongst other prayers, the respondent claimed:-(a) one hundred million naira as general damages for malicious breach of contract and negligent conduct;(b) sixty-four million, two hundred and fifty thousand, nine hundred and twenty naira as special damages;(c) one million, five hundred thousand naira only being the cost of this action; and(d) 10% interest per annum on the judgment sum, from the date of judgment until liquidation.The appellant denied the claim and on exchange of pleadings...

Снова вопрос

Я хочу сохранить теги HTML в данных при удалении тегов XML

Обратите внимание Это полный XML, структура которого не может быть предсказана, и я хочу извлечь все значения в XML, а не только часть

...