simplexml - can it do what I need?

From: Date: Sat, 06 Feb 2010 16:46:16 +0000
Subject: simplexml - can it do what I need?
Groups: php.general 
Request: Send a blank email to php-general+get-301850@lists.php.net to get a copy of this message
My first post and I'm just a few days into learning PHP so that I can extract data from an XML feed for updating a MySQL driven website. Simplexml grabs most of my data without a problem but I can't get at the data in elements such as: <element idtype="11" lang="fr" label="Description - Etage"><![CDATA[Rez de jardin]]></element> <element idtype="1" lang="fr" label="Description - Nombre de pièces"><![CDATA[1]]></element> <element idtype="2" lang="fr" label="Description - Nombre de chambres"><![CDATA[0]]></element> <element idtype="3" lang="fr" label="Description - Surface totale (m²)"><![CDATA[27]]></element> I have around a hundred of these elements but only need data from two of them. I need to extract the CDATA by specifying the idtype and lang attribute. For example, in the first of these elements, I need to be able to get out the string "Rez de jardin" by specifying idtype="11" and lang="fr". Can I use Simplexml to do this and, if so, how? If not, what should I use? Many thanks for any help. Terry -- View this message in context: http://old.nabble.com/simplexml---can-it-do-what-I-need--tp27481222p27481222.html Sent from the PHP - General mailing list archive at Nabble.com.

« previous php.general (#301850) next »