eZ Community » Forums » Extensions » SQLIImport > XML import
expandshrink

SQLIImport > XML import

SQLIImport > XML import

Monday 02 April 2012 6:46:06 pm - 3 replies

Hi @ all,

sorry - for that - but i can not find the error... with RSS feeds everything works - but not with my own XML files... the only difference is the  <channel> in my own files <gisdata>

i copy the file sqlirssimporthandler.php to sqligiscontinentimporthandler.php... and change a few lines...

<code>

    /**
     * (non-PHPdoc)
     * @see extension/sqliimport/classes/sourcehandlers/ISQLIImportHandler::getProcessLength()
     */
    public function getProcessLength()
    {
        if( !isset( $this->rowCount ) )
        {
            $this->rowCount = count( $this->dataSource->gisdata->item );
        }
        return $this->rowCount;
    }
   
    /**
     * (non-PHPdoc)
     * @see extension/sqliimport/classes/sourcehandlers/ISQLIImportHandler::getNextRow()
     */
    public function getNextRow()
    {
        if( $this->rowIndex < $this->rowCount )
        {
            $row = $this->dataSource->gisdata->item[$this->rowIndex];
            $this->rowIndex++;
        }
        else
        {
            $row = false; // We must return false if we already processed all rows
        }
       
        return $row;
    }

</code>

but no data is imported... the Process = 0... what I need to change so that data can be imported with the following structure?

<code>

<gisdata>
    <item>
        <name>Europe </name>
        <iso-3166-alpha2></iso-3166-alpha2>
        <iso-3166-alpha3></iso-3166-alpha3>
        <iso-3166-numeric></iso-3166-numeric>
        <fips></fips>
        <description></description>
        <area-km2></area-km2>
        <gisid>gis-continent-0000000005</gisid>
    </item>
</gisdata>

</code>

with RSS feeds it works - with this structure

<code>

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title></title>
    <link>http://www.myurl.net/</link>
    <description></description>
    <language></language>
    <managingEditor></managingEditor>
    <pubDate>Mon, 02 Apr 2012 16:36:40 +0000</pubDate>
    <lastBuildDate>Mon, 02 Apr 2012 16:36:40 +0000</lastBuildDate>
    <generator>eZ Components Feed 1.3 (http://ezcomponents.org/docs/tutorials/Feed)</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <atom:link href="http://www.myurl.net/rss/feed/gisdata" rel="self" type="application/rss+xml"/>
        <item>
            <name>Europe </name>
            <iso-3166-alpha2></iso-3166-alpha2>
            <iso-3166-alpha3></iso-3166-alpha3>
            <iso-3166-numeric></iso-3166-numeric>
            <fips></fips>
            <description></description>
            <area-km2></area-km2>
            <gisid>gis-continent-0000000005</gisid>
        </item>
  </channel>
</rss>

</code>

 

I thank you in advance for your help!!!

Tuesday 03 April 2012 7:40:49 am

Hello,

do you try to change your file with this :

<?xml version="1.0" encoding="utf-8"?>
<gisdata>
    <item>
        <name>Europe </name>
        <iso-3166-alpha2></iso-3166-alpha2>
        <iso-3166-alpha3></iso-3166-alpha3>
        <iso-3166-numeric></iso-3166-numeric>
        <fips></fips>
        <description></description>
        <area-km2></area-km2>
        <gisid>gis-continent-0000000005</gisid>
    </item>
</gisdata>

in fact , i think your file seems to be xml but it was not xml. try it and tell us ...

 

Alexandre

 

 

Wednesday 04 April 2012 6:57:58 pm

Hi Alexandre,

here is the link to my fork and the GIS Continent Data

https://github.com/MichaelLo/SQLIImport

i think my xml file looks ok....

but no import...

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

Now processing "GIS Continent Import Handler" handler.
0 / 0 [>                                                             ]   0.00%
Now cleaning the import process
Import is over happy.gif Emoticon
Peak memory usage : 11.77M

Thats all...

Friday 06 April 2012 5:18:50 pm

hello,

sorry to be so late , i didnot view your answer ...

is the user which run the command line has right on the file ? the file is not in the extension , i cant tell you if it is safe and good...

do you change files from extension sqliimport ?

 

tell me i can try to help you ...

 

Alexandre

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from