Parse CDATA contents with SimpleXML

March 29th, 2011 by Alex Leave a reply »

I rarely use SimpleXML, but lately i was trying to parse a simple RSS file, and what i saw is empty string where CDATA was. Luckily, the fix is simple – when you run the parser, just include additional parameters like this:

$xml = simplexml_load_string($string, 'SimpleXMLElement', LIBXML_NOCDATA);

Good luck parsing xml 🙂

This page can be found by searching for:

android xml cdata

Comments are closed.