eZ Community » Forums » Extensions » sqliimport and xml file
expandshrink

sqliimport and xml file

sqliimport and xml file

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 3:50:55 pm

Salam

I think you missed a few lines in the config sqliimport,

[ImportSettings]
AvailableSourceHandlers[]=Testimporthandler

Wednesday 11 May 2011 4:01:11 pm

No, I already added this code, but it still does not.

[ImportSettings]
AvailableSourceHandlers[]=testimporthandler

The import appears in the list.

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 9:05:38 am

Thank you, that was the problem. I manage to create these items, but only with this command:
 

php extension/sqliimport/bin/php/sqlidoimport.php
 Why backend import does not work? 

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

Thursday 12 May 2011 4:51:22 pm

Hello,

I manage to import with the shell but not with the interface.

Jonathan

Thursday 12 May 2011 6:07:34 pm

Yes, or is it the problem is, you need only launched this command:

php extension/sqliimport/bin/php/sqlidoimport.php --source-handlers = testimporthandler

Thursday 12 May 2011 6:45:17 pm

I do not understand the interest of creating an admin interface like this

it does not execute the command without.

Modified on Thursday 12 May 2011 6:47:45 pm by Jonathan Clavier

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 blunk.gif Emoticon

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.

Wednesday 18 May 2011 4:26:03 pm

Thank you, I had a problem in the cron

Wednesday 18 May 2011 6:39:29 pm

Thanks, it runs perfectly

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from