473,395 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

parse huge XML file

Hi all,

I need help for parsing a huge XML file with some ISP limits (I can't change
ISP, so this isn't a solution).

The ISP limits the scripts to 16MB and 10 seconds. Those params can't be
changed (no set function available either no config available).
So my file contains an export from different customers. Those export can be
quite large (20MB) and contains the full article description and the
attached pictures.

For now I parse the XML files, record the values in my DB and save pictures
on a server.
Obviously, due to the size of the actual XML and to the limits of the ISP, I
often run on Time Exceed error.

I've many articles in the XML export, each having 0 to 10 pictures. My idea
is to "refresh" the page after each article has been created in the DB.
My question are:
- how can I manage the refresh after each article ?
- how can I read from the file a block big enough to avoid to have only part
of the article description ?
I'm not so confortable with XML parsing. It's there any PHP code that will
put everything in an array in order to manage this using structures or
whatever ?

Thanks for help.

Bob

Nov 17 '06 #1
1 2607
Hi,

Regarding the time limitations, you could try a driver script that
calls another script to perform an action on each file. Something like:

foreach (glob(dirname(__FILE__) . '/*.xml) as $file) {
$url = 'http://' . $_SERVER['HTTP_HOST'] .
'/admin/loadArticle.php?file=' .
urlencode($file) . ';'.
readfile($url);
}

The hope in this case is that the time spent waiting in readfile()
won't actually count toward the script time limit.

As for the memory limits, you might try the expat-based XML functions
at php.net/xml which are event-driven. There's also the DOM extension
at php.net/dom which parses XML into a DOMDocument structure.

Bob Bedford wrote:
Hi all,

I need help for parsing a huge XML file with some ISP limits (I can't change
ISP, so this isn't a solution).

The ISP limits the scripts to 16MB and 10 seconds. Those params can't be
changed (no set function available either no config available).
So my file contains an export from different customers. Those export can be
quite large (20MB) and contains the full article description and the
attached pictures.

For now I parse the XML files, record the values in my DB and save pictures
on a server.
Obviously, due to the size of the actual XML and to the limits of the ISP, I
often run on Time Exceed error.

I've many articles in the XML export, each having 0 to 10 pictures. My idea
is to "refresh" the page after each article has been created in the DB.
My question are:
- how can I manage the refresh after each article ?
- how can I read from the file a block big enough to avoid to have only part
of the article description ?
I'm not so confortable with XML parsing. It's there any PHP code that will
put everything in an array in order to manage this using structures or
whatever ?

Thanks for help.

Bob
Nov 19 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Johnny Google | last post by:
Here is an example of the type of data from a file I will have: Apple,4322,3435,4653,6543,4652 Banana,6934,5423,6753,6531 Carrot,3454,4534,3434,1111,9120,5453 Cheese,4411,5522,6622,6641 The...
21
by: William Stacey [MVP] | last post by:
Anyone know of some library that will parse files like following: options { directory "/etc"; allow-query { any; }; // This is the default recursion no; listen-on { 192.168.0.225;...
8
by: Rico | last post by:
Hello Everyone, I observed something strange in some quick testing code: void Button1Click(object sender, System.EventArgs e) { CultureInfo culture = new CultureInfo("th-TH", false); ...
6
by: trevor | last post by:
Incorrect values when using float.Parse(string) I have discovered a problem with float.Parse(string) not getting values exactly correct in some circumstances(CSV file source) but in very similar...
9
by: Bo Yang | last post by:
Hi, guys. I am now developing an application in which I need to fetch some html page, and then parsing it to get some intended content in it. Because HTML is not a standard XML format, so I am...
5
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C++ programming. FYI Although I have called...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
9
by: Krumble Bunk | last post by:
Hi all, I am trying my hands at writing a shell for unix. A very rubbish shell, but nonetheless, I come to a point where I am confused. I would like to have something like shellstop xyz ...
5
by: goldtech | last post by:
SAX XML Parse Python error message Hi, My first attempt at SAX, but have an error message I need help with. I cite the error message, code, and xml below. Be grateful if anyone can tell me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.