Open tablatronix opened 11 years ago
This is normal, and probably not fixable. Would need to parse this with my own function and not a native php dumping function.
http://www.php.net/manual/en/function.simplexml-load-file.php#73367
To correctly extract a value from a CDATA just make sure you cast the SimpleXML Element to a string value by using the cast operator:
$xml = '<?xml version="1.0" encoding="UTF-8" ?>
<rss>
<channel>
<item>
<title><![CDATA[Tom & Jerry]]></title>
</item>
</channel>
</rss>';
$xml = simplexml_load_string($xml);
// echo does the casting for you
echo $xml->channel->item->title;
// but vardump (or print_r) not!
var_dump($xml->channel->item->title);
// so cast the SimpleXML Element to 'string' solve this issue
var_dump((string) $xml->channel->item->title);
/*
Above will output:
Tom & Jerry
object(SimpleXMLElement)#4 (0) {}
string(11) "Tom & Jerry"
*/
Add custom callout, if simplexml object process via recursive and cast all leaves, so I can get strings out.
Shows empty