9 juli 2008

CDATA with simpleXML (PHP)

It is been a while. But I'm back.

A lot of new Web 2.0 applications use API's. Most of the time they return XML, and some of those services do it well by encapsulating their data in CDATA-tags.

But simpleXML doesn't like CDATA. Think again. Use the code below and you will have full access to the data in the CDATA-tags.

$xml simplexml_load_string($string'SimpleXMLElement'LIBXML_NOCDATA);
?>

Have fun!

Dit artikel gaat over: , , , , , , . CDATA with simpleXML (PHP) werd geschreven door Tijs.
Er zijn al 2 reacties.

Reacties

Pritesh Patel

Pritesh Patel schreef:
16/10/08

Doesn't seem to work for me!

Steve

Steve schreef:
07/05/09

I see how that should work, but it doesn't appear to be working for me either.

Reageer velden gemarkeerd met een sterretje zijn verplicht

*