From The Blog

PHP: parsing all the XML including CDATA

22 October 2012, in PHP

It is common when writing XML files to put data like HTML and XML in CDATA to avoid mixing between XML tags and content tags

but whatever comes inside CDATA is ignored, and not parsed

so to read which inside it when parsing XML add the attribute "LIBXML_NOCDATA" like this:

$xml = simplexml_load_file('xmlfile', NULL, LIBXML_NOCDATA);


Post a Comment