Wednesday 11 May 2011 2:56:36 pm - 13 replies
Hello,
I would like to import the following xml:
<?xml version="1.0" encoding="UTF-8"?> <test> <article> <title>France</title> <intro>fr</intro> </article> <article> <title>Allemagne</title> <intro>al</intro> </article> <article> <title>Italie</title> <intro>it</intro> </article> </test>
and I created class with the process method TestImportHandler following:
// $row is a SimpleXMLElement object $this->currentGUID = $row->intro; $contentOptions = new SQLIContentOptions( array( 'class_identifier' => 'article', 'remote_id' => (string)$row->intro ) ); print (string)$row->title; $content = SQLIContent::create( $contentOptions ); $content->fields->title = (string)$row->title; $content->fields->intro = (string)$row->intro; // Now publish content $content->addLocation( SQLILocation::fromNodeID( $this->handlerConfArray['DefaultParentNodeID'] ) ); $publisher = SQLIContentPublisher::getInstance(); $publisher->publish( $content ); // Free some memory. Internal methods eZContentObject::clearCache() and eZContentObject::resetDataMap() will be called // @see SQLIContent::__destruct() unset( $content );
and I changed the sqliimport config :
[testimporthandler-HandlerSettings] Enabled=true Name=Test XML ClassName=TestImportHandler Debug=enabled DefaultParentNodeID=2 xmlFile=/var/www/ez/extension/sqliimport/stubs/test.xml
but, the xml is not imported. Progress remains at 0. No error log. What is my mistake?
Modified on Wednesday 11 May 2011 3:38:23 pm by Jonathan Clavier
Wednesday 11 May 2011 7:28:40 pm
according to the source code as you showed, you use the article class, while the latter has the field as a block Intro XML, an XML attribute necks you get it this way:
$htmlMessage = '<p>My <strong>HTML</strong> content</p>';
$parser = new SQLIXMLInputParser();
$parser->setParseLineBreaks( true );
$document = $parser->process( $htmlMessage ); // Result is a DOM Document
$eZXMLString = eZXMLTextType::domString( $document );
But I am not sure, it remains a test solution
Thursday 12 May 2011 12:33:21 pm
Salam,
I think you need to use the commands
classes exist to learn: php extension/sqliimport/bin/php/sqlidoimport.php --list-source-handlers
And to initiate an import specific you had to use this command
php extension/sqliimport/bin/php/sqlidoimport.php --source-handlers = testimporthandler
Merci
Amine
Blog perso : www.abetari.com
Wednesday 18 May 2011 1:54:47 pm
I'm trying to execute via command line my own handler, but I can't continue with the proves, this message appear:
"Another import is already running. Aborting..."
I tried to delete all cachés, delete all imports in control panel and restart the apache, but nothing happened
What can I do?
Thanks
Wednesday 18 May 2011 4:11:06 pm
I do not understand the interest of creating an admin interface like this
it does not execute the command without.
You need to run the cronjob in the crontab, as it is spotted in the doc ![]()
http://svn.projects.ez.no/sqliimport/trunk/doc/INSTALL.txt
Wednesday 18 May 2011 4:14:39 pm
I'm trying to execute via command line my own handler, but I can't continue with the proves, this message appear:
"Another import is already running. Aborting..."
I tried to delete all cachés, delete all imports in control panel and restart the apache, but nothing happened
What can I do?
Thanks
Maybe one of your previous imports failed (are you debugging ?). You can fix this by deleting the sqliimport_status entry from ezsite_data table.
You must be logged in to post messages in this topic!