Isn't it simply a question of having a variable $category that would be updateted each time you have a line starting with <CATEGORY? Regards Henrik Hornemann The Royal Library Copenhagen Universitylibrary Facultylaíbrary for Science and Medicine -----Oprindelig meddelelse----- Fra: Andy Rolls-Drew [mailto:andy_rd@xxxxxxxxxxx] Sendt: 9. maj 2006 11:04 Til: php-db@xxxxxxxxxxxxx Emne: Parse Problem Prioritet: Høj All, I am fairly new to parsing XML using PHP and wonder if anyone has a solution to the following. I have a file eg:- <<?xml version="1.0" ?> <STOREITEMS> <CREATED value="Wed Mar 15 8:07:27 GMT 2006"> <CATEGORY id='67' name='Herbal Pharmacy'> <PRODUCT ITEM='603'> <NAME></NAME> <MODEL></MODEL> <PRICE></PRICE> <PRODUCT ITEM='608'> <NAME></NAME> <MODEL></MODEL> <PRICE></PRICE> <CATEGORY id='69' name='Extras'> <PRODUCT ITEM='1123'> <NAME></NAME> <MODEL></MODEL> <PRICE></PRICE> <PRODUCT ITEM='2034'> <NAME></NAME> <MODEL></MODEL> <PRICE></PRICE> And so on. I have managed to parse a little of it using Magic Parser but I still cant manage to split the products and categories correctly. If there weren't multiple products for each category I think I would have it. Any help would be a start. Thanks in advance Andy ARD Drive Consultants Drive to Perfection Rolls-Drew, Andrew Director ARD Drive Consultants Ltd 169 Nottingham Road Melton Mowbray Leicestershire UK <mailto:andyrd@xxxxxxxxxxxxxxx> andyrd@xxxxxxxxxxxxxxx AIM: DarkoneARDDrive tel: fax: mobile: Skype ID: +44 7092 162782 +44 7092 162782 +447929418215 andyrd <https://www.plaxo.com/add_me?u=30065438052&v0=1330159&k0=-1748648187> Add me to your address book... <http://www.plaxo.com/signature> Want a signature like this? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php