Hello,
I have an endpoint that returns XML data but with HTMl as content,
So far using simplexml_load_string($result, "SimpleXMLElement", LIBXML_NOCDATA);
returns a striped verion i.e all tags were removed
Sample Data
<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>
Parsing through my method
protected function scaffoldXML($result)
{
$xml = simplexml_load_string($result, "SimpleXMLElement", LIBXML_NOCDATA);
return $json = json_encode($xml);
}
Returns
"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...
Question Again
I want to retain the HTML tags in the data while removing the XML tags
Please Note It is a full XML whose structure cannot be predicted and i want to extract all the values in the XML not just part
` tags are just part of the XML). – IMSoP May 08 '18 at 11:39