SV: [PHP-DB] Parse Problem

2006-05-09 Thread Henrik Hornemann

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:[EMAIL PROTECTED] 
Sendt: 9. maj 2006 11:04
Til: php-db@lists.php.net
Emne: [PHP-DB] 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:[EMAIL PROTECTED] [EMAIL PROTECTED]
AIM: DarkoneARDDrive 


tel: 
fax: 
mobile: 
Skype ID:

+44 7092 162782
+44 7092 162782
+447929418215
andyrd 

 



 https://www.plaxo.com/add_me?u=30065438052v0=1330159k0=-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



Re: SV: [PHP-DB] Parse Problem

2006-05-09 Thread Constantin Wolber

First of all you should use a well-formed xml.

If your XML is well-formed you should check some XML Parsing Tutorial. 
Like this one: http://www.sitepoint.com/print/560


Eventhough it's written to parse an rss feed, you can use the same idea 
for parsing your files.


Constantin Wolber


Isn't it simply a question of having a variable $category that would be updateted 
each time you have a line starting with CATEGORY?

?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

 



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