TerryA wrote:
> 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

Look at the options:

$xml = simplexml_load_file('file.xml', 'SimpleXMLElement', LIBXML_NOCDATA);


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to