--- Marc Boncz <[EMAIL PROTECTED]> wrote:

> My problem is: they don't export these values as .csv format (which would be
> muuuuuch easier, just read the response line by line, 'explode' the line,
> and use the first value as primary key and the second as description).
> Instead, they publish an XML file, in which values are given like
> 
> 
> <row>
>  <id>68</id>
>  <cat_name>Aanvoer & aandrijftechniek</cat_name>
> </row>
> 
> anybody who has a 'quick 'n dirty' hack for how to extract rapidly for each
> row the values for 'id' and 'cat_name'?
> 
> Any parsing that goes beyond 'fgetcsv' and then 'explode' always seemed like
> a huge waste of time to me when exporting csv is so much quicker and
> simpler. But I guess even my time to start working on XML has come :-(
> 
> Marc

In the "quick and dirty" category is xml_parse_into_struct() which can take the
XML and turn it into a deep associative array:

http://us.php.net/manual/en/function.xml-parse-into-struct.php

It may be the simplest to work with and if your data is fairly simple and
regular then you can probably get it to work for you.

James

Reply via email to