sqliimport and xml file

Author Message

Jonathan Clavier

Wednesday 11 May 2011 5:56:36 am

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?

Amine BETARI

Wednesday 11 May 2011 6:50:55 am

Salam

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

[ImportSettings]
AvailableSourceHandlers[]=Testimporthandler

Jonathan Clavier

Wednesday 11 May 2011 7:01:11 am

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

[ImportSettings]
AvailableSourceHandlers[]=testimporthandler

The import appears in the list.

Amine BETARI

Wednesday 11 May 2011 10:28:40 am

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

Jonathan Clavier

Thursday 12 May 2011 12: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? 

Amine BETARI

Thursday 12 May 2011 3:33:21 am

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

Jonathan Clavier

Thursday 12 May 2011 7:51:22 am

Hello,

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

Jonathan

Amine BETARI

Thursday 12 May 2011 9:07:34 am

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

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

Jonathan Clavier

Thursday 12 May 2011 9:45:17 am

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

it does not execute the command without.

Alex Muñoz

Wednesday 18 May 2011 4:54:47 am

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

Jérôme Vieilledent

Wednesday 18 May 2011 7:11:06 am

"

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

Jérôme Vieilledent

Wednesday 18 May 2011 7:14:39 am

"

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.

Jonathan Clavier

Wednesday 18 May 2011 7:26:03 am

Thank you, I had a problem in the cron

Alex Muñoz

Wednesday 18 May 2011 9:39:29 am

Thanks, it runs perfectly

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 02:19:59
Script start
Timing: Jan 18 2025 02:19:59
Module start 'layout'
Timing: Jan 18 2025 02:19:59
Module start 'content'
Timing: Jan 18 2025 02:19:59
Module end 'content'
Timing: Jan 18 2025 02:19:59
Script end

Main resources:

Total runtime0.5767 sec
Peak memory usage4,096.0000 KB
Database Queries95

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 587.9063152.6250
Module start 'layout' 0.00470.0025 740.531339.4531
Module start 'content' 0.00720.5679 779.9844726.6250
Module end 'content' 0.57510.0015 1,506.609424.1719
Script end 0.5766  1,530.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.5510160.0002
Check MTime0.00140.2357160.0001
Mysql Total
Database connection0.00060.100810.0006
Mysqli_queries0.490585.0532950.0052
Looping result0.00070.1287930.0000
Template Total0.548995.220.2745
Template load0.00180.316320.0009
Template processing0.547194.872920.2735
Template load and register function0.00010.020610.0001
states
state_id_array0.00110.192210.0011
state_identifier_array0.00120.202920.0006
Override
Cache load0.00170.3035870.0000
Sytem overhead
Fetch class attribute can translate value0.00080.135440.0002
Fetch class attribute name0.00090.1624160.0001
XML
Image XML parsing0.00130.217140.0003
class_abstraction
Instantiating content class attribute0.00000.0057180.0000
General
dbfile0.00090.1642230.0000
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
14content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
26content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
4content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
3content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/quote.tpldatatype/ezxmltext/quote.tplextension/ezwebin/design/ezwebin/override/templates/datatype/ezxmltext/quote.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 67
 Number of unique templates used: 11

Time used to render debug report: 0.0001 secs