How to parse big XMLs!!!

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
sherrylady
Forum Newbie
Posts: 4
Joined: Tue Apr 08, 2008 2:47 am

How to parse big XMLs!!!

Post by sherrylady »

Hi all!!!
I'm developing an application in PHP and in one module I have to parse some XML files and show them in the page, the problem is some of these XML files are big!!! so Its take time to load the page!!! and this application goin to have at least 10 visitors per second, so it will be a problem for me!!! what should I do to reduce the loading time, for example is it better to parse the XML in java script then send it to PHP?
Thanks
Sherry
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: How to parse big XMLs!!!

Post by arjan.top »

XMLReader
User avatar
sherrylady
Forum Newbie
Posts: 4
Joined: Tue Apr 08, 2008 2:47 am

Re: How to parse big XMLs!!!

Post by sherrylady »

Thanks for your reply, you mean only XMLReader class is enough?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How to parse big XMLs!!!

Post by pickle »

How often is this XML file going to be changed? If you're having 10 visitors a second access a file that changes hourly, it could be useful to have either a) just the first visitor parse it & store the result of parsing it in a PHP file for the others to include or b) (preferably) have a cron job parse it.

Of course, this may not be practical depending on what data is in the XML file.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
sherrylady
Forum Newbie
Posts: 4
Joined: Tue Apr 08, 2008 2:47 am

Re: How to parse big XMLs!!!

Post by sherrylady »

Hi, Thanks for your reply
Actually I cant use cron job because for example they are not going to update in every 10 min, it depends on the operator to enter the new data in the main database and then that Data base send me the resualt in different XMLs 8O
so whats you suggestion!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How to parse big XMLs!!!

Post by pickle »

Have the XML parsed when it's sent to you once, rather than re-parsing it over & over & over.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
sherrylady
Forum Newbie
Posts: 4
Joined: Tue Apr 08, 2008 2:47 am

Re: How to parse big XMLs!!!

Post by sherrylady »

Really thanks and sorry for late reply :)
Post Reply