Page 1 of 1

XML import fails with single record

PostPosted: Sat Aug 18, 2012 1:27 pm
by nusskratzer
Hello,
I am trying to import a set of records written in an XML file to the table "mytable". I added following method in the delegate class for "mytable":

Code: Select all
function __import__xml(&$data, $defaultValues=array()){
import('Dataface/ImportFilter/xml.php');
$datafilter = new Dataface_ImportFilter_xml();
$records = $datafilter->import(&$data);
return $records;
}

This does work with XML files containing at least 2 records, but fails when the XML file contains a single record (same result when copy&pasting the xml data into the textarea of the "import records" page instead of uploading an XML file).

It fails because I get the message "Found 12 records to import", where 12 is actually the number of different fields in one record. If I preview the result, it shows a list of 12 empty records, and if I proceed to insert I obtain the message "Records imported successfully", but nothing actually happened (same number of records in the database than before).

Please could you help me solving this issue?