I'm parsing XML with PHP using simplexml_load_file
, then I json_encode
and json_decode
in order to get all the info as arrays:
$xml = simplexml_load_file('/var/www/darkglass/wp-content/themes/dark2/assets/xml/artists.xml');
$musicos = json_encode($xml);
$musicos = json_decode($musicos, true);
I'm having this problem where I want to add a HTML code inside the tag, but it only works if I add a character before the <![CDATA
like the example below:
This doesn't work:
<band><![CDATA[<a class="abandlink" href="#">Cannibal Corpse</a>]]></band>
This works:
<band>.<![CDATA[<a class="abandlink" href="#">Cannibal Corpse</a>]]></band>
Any idea why is this happening?