Forums / Developer / Import XML Data Topic / Comment44898
Thomas Nunninger
Sunday 18 June 2006 5:41:00 am
Another thing: I can't see the sense of the $i counter. If you import many data you will fill your memory because all the XML data of all the just saved objects is still available. Just replace
foreach ($paths_item as $path_item) { foreach($fieldNameList as $fieldName) { $fieldValue = $xPathEngine->wholeText("$path_item/$fieldName"."[1]"); $parsedItems[$i][$fieldName]=$fieldValue; if ($fieldName=='account-login') $isAcountObject=true; }
with
foreach ($paths_item as $path_item) { $parsedItems = array(); // resets the parsed data foreach($fieldNameList as $fieldName) { $fieldValue = $xPathEngine->wholeText("$path_item/$fieldName"."[1]"); $parsedItems[$fieldName]=$fieldValue; // delete the [$i] everywhere if ($fieldName=='account-login') $isAcountObject=true; }
Have a nice day and of course: thanks for the extension - saves much work :-)
Thomas
Edit: Sorry, I didn't read the next lines:
$result['data']= $parsedItems;
But I don't know if you really want that feature in a mass import situation...