473,246 Members | 1,731 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,246 software developers and data experts.

BIG problem.

I've to manage quite very large XML files. I tough it was an SQL error, but
I've figured out the problem is somewhere else.

I've a big structure, with lot of datas and pictures encoded in every XML
files. Sometimes, I've error, and the script crashes.

Here is the code:

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "FDataHandler");

while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
die(sprintf("XML error: %s at line %d",
rename($XMLPath.$file, $XMLPath.$failpath.$file); //move file in error
$OK = false;

Now, this part of the code takes 4096 bytes and parse datas:

Now, if the 4096 bytes are in the middle of the file, I get big problems. In
my case, the data2 is cutted somewhere in the middle
The script should only work when the </datastart> is reached, isn'it ??? but
how to do so ? The actual file is 5MB large, with lot of pictures in it.

Jul 17 '05 #1
2 1288
*** Bob Bedford wrote/escribió (Mon, 17 Jan 2005 18:05:43 +0100):
while ($data = fread($fp, 4096)) { ^^^^
Now, if the 4096 bytes are in the middle of the file, I get big problems.

Does you XML parser consider the case where elements are larger than 4096

-- Álvaro G. Vicario - Burgos, Spain
-- Thank you for not e-mailing me your questions
Jul 17 '05 #2
"Alvaro G Vicario" <al******************@telecomputeronline.com> a écrit
dans le message de news: 1j******************************@40tude.net...
*** Bob Bedford wrote/escribió (Mon, 17 Jan 2005 18:05:43 +0100):
while ($data = fread($fp, 4096)) {

Now, if the 4096 bytes are in the middle of the file, I get big problems.

Does you XML parser consider the case where elements are larger than 4096

Actually not, because I don't know how to do so.
I do have this:

function endElement($parser, $name)
case 'datastart': //commencer à enregistrer les données importantes pour
les véhicules
//save in DB. Get the error here sometimes
I didn't manage to check if the elements were larger than 4096 as I tough
the save in DB code was only executed when the closing tag was reached. If
I'm wrong, what's the solution ?

Jul 17 '05 #3

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

Similar topics

by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
by: Peter Olcott | last post by:
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
by: =?Utf-8?B?am8uZWw=?= | last post by:
Hello All, I am developing an Input Methop (IM) for PocketPC / Windows Mobile (PPC/WM). On some devices the IM will not start. The IM appears in the IM-List but when it is selected from the...
by: sherifbk | last post by:
Problem description ============== - I have 4 clients and 1 server (SQL server) - 3 clients are Monitoring console 1 client is operation console - Monitoring console collects some data from...
by: AceKnocks | last post by:
I am working on a framework design problem in which I have to design a C++ based framework capable of solving three puzzles for now but actually it should work with a general puzzle of any kind and I...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.