This is not a JSON encoding problem - it var_dump($sxml->Details)shows that SimpleXML has already mixed it up, since you only get
object(SimpleXMLElement)#2 (0) {
}
- "empty" SimpleXMLElement, the contents of CDATA are already missing.
, (, , ), googling "simplexml cdata" SimpleXML-, :
CDATA simplexml, str_replace/preg_replace CDATA simplexml.
, CDATA .
$xml = simplexml_load_file($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA);
,
$sxml = simplexml_load_string($resultXML, 'SimpleXMLElement', LIBXML_NOCDATA);
,
{"Company":"fcsf","Details":"\n fgrtgrthtyfgvb\n "}
JSON.