tags:

views:

9

answers:

0

Hi,

i have a large XML file with 22000 records that i have to import in my DB.

I am looking how to parse the xml with pagging ,meaning

parse.php?start=0; //this script get the 0-500 firt records of file
parse.php?start=500 //this script get the 500-1000 records of file

This way i can bypass memory problems.

My problem is how to point at record 500 when load the xml file

My code is simple

$data=simplexml_load_file($xmlFile);

foreach ($data->product as $product) { foreach($product->children() as $section) { addToDB($section); } }

The code above works fine for 1000-2000 records but i want to modify as mentioned to work with lagre XMLs

Any suggestion.