Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Processing large xml file with php

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Processing large xml file with php

Postby jo1991 » Thu May 30, 2013 3:47 am

Hi eveyboady,
I'm new in php/Mysqal and XML.
I need to read and exctract many and specific information fom a large XML file about (about 3000 lines).
i need to Retrieve many Elements and Attributes values. then i insert them into database.

the problem is about how to exctrct over 100 of Elements and Attributes.
i was thinking about create class(s). what do you think?
i need this too much please.
thanks.
jo1991
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu May 30, 2013 3:46 am

Re: Processing large xml file with php

Postby johnj » Thu May 30, 2013 6:17 am

johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Processing large xml file with php

Postby jo1991 » Fri May 31, 2013 12:32 am

hello johnj,
thanks for your replay

in fact, i need to read and extract data from a large xml file (about 3000 lines) which is like this:

<controle val="U22W0520111">
for example: i need to extract val,

then extracting some elements look like this <name>jon</name>

and so on. the problem is i should extract over 100 elements and values form this large file, also these data can be found in many elements , not only from one part or one node.

so imagine how many founctions i need to exctract over 100 elements and values attributes,.....

and after exctracting these values, i must insert them into mysql database.

the question is: do you any idea about how i can extract them without needing to repeat the fonction over 100 times for the extraction. i.e create class to extract and insert the values dirctly into database.

thank you again,
JO
jo1991
New php-forum User
New php-forum User
 
Posts: 3
Joined: Thu May 30, 2013 3:46 am

Re: Processing large xml file with php

Postby johnj » Fri May 31, 2013 8:05 am

why is it that extracting 100 elements a problem?
Whether to make it object oriented using classes is a matter of convenience.
As long as you know what to extract, you have solved half the problem. please go through the tutorials on the link that I gave you before.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 2 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.