Search

I've upgraded my Symphony version to 2.2, but I've downloaded the latest version of the XML Importer and installed it.

Can you tell me where I can find the rows that I have to change? I can't find them inside the files of the XML Importer.

They would be in your workspace/xml-importers folder. You have to modify each importer that originated from Symphony < 2.2.

I'm trying to import the xml from google weather api, but because the encoding in the xml file is missing, the import process doesn't works. There's a way to make it works?

Edit: solved by creating a new xml page with attached a dynamic data source of g-weather, and then xml-imported it.

When importing data I often have the need to modify the import values based on the context: if a equals b, do this - if a equals c, do that. For this reason I join different nodes using a stupid separator (like ###|||###) and pass the new string to a custom PHP function which splits the string in pieces again and processes.

It all feels a bit hacky so I asked myself if it would be possible to pass the current XML node as second argument to the function in the XMLImporterHelpers class?

Scratch that last post. If you need to import based on context, set the xPath expression to . and use something similar to this in your PHP function for your manipulations:

static function getUser($string) {
    $xml = simplexml_load_string($string);

    // Get user
    if($xml->retweeted_status) {
        $user = $xml->retweeted_status->user->screen_name;
    }
    else {
        $user = $xml->user->screen_name;
    }

    return $user;
}

Is is possible to run the php script with a cronjob?

Yep, each importer has a "run" URL:

/symphony/extension/xmlimporter/importers/run/{importer-handle}/

To run from a cron you'll need to pass ?auth-token={token} where the token is the hash portion of the auto-login URL when you check this option for a Symphony author. This will let the cron create a session, logging the request into the backend.

Thanks, I will try it..

Quick question. I installed a fresh copy of v2.2.1 with the XML importer extension. I get the following...

streamsettimeout() has been disabled for security reasons /home/vol5/.../{account-username}/htdocs/symphony/lib/toolkit/class.gateway.php line 357

352
353         // send request
354         if(!@fwrite($handle, $query)) return false;
355
356         stream_set_blocking($handle, false);
357         stream_set_timeout($handle, $this->_timeout);
358
359         $status = stream_get_meta_data($handle);
360
361         // get header

As you can see, my host has blocked certain functions. Is it possible to run XML import by commenting out line 357? I tried that and it didn't work. It just gave me a blank page when I tried running the importer.

The previous versions of XML importer worked fine... So is there a way to get around this? Help much appreciated.

I have this error showing up when trying to import very plain xml:

Import Failed
Import failed because 7208 entries did not validate, a total of 0 entries passed.

Import entry #1
<entry>
  <artist_id>
    <entry id="24383"/>
  </artist_id>
  <book_id>
    <entry id="24822"/>
  </book_id>
  <type/>
  <page_numbers>837/8</page_numbers>
</entry>

array (
  'artist' => '24383',
  'book' => '24822',
  'pages' => '837/8',
  'book-type' => '',
)

All of the entries are very similar to this. I even tried passing them through htmlspecialchars function but still the same result.

Ignore that last one. None of the fields in the section we're required, but I went through, ticked and un-ticked them, and now it works fine...

Odd...

The unique field stuff is still a little weird on this. I had accidentally selected a field as unique, then selected no unique to fix it, yet the unique field ref stayed in the importer.

Any reason why code that causes the extension not to work in Symphony 2.2.1 is retained in the latest release?

See this link.

Nevermind, I see now, we are changing the files created by previous versions in workspace/xml-importers. Once again the forum is gold.

I'm having the same problem as @designermonkey above...

Import Failed
Import failed because 76 entries did not validate, a total of 0 entries passed.
  • It looks like it's dying on the date field.
  • I'm importing the date as an ISO format. (2011-05-20).
  • If I remove the date field altogether, it works. This wasn't the case on previous versions. You could import a date into date field. Any suggestions???

Brian, I've had date field issues too, but just removed them as all I needed was a year. It looks like the date has to be imported exactly as the field expects. Is this the trouble you're having?

It looks like the date has to be imported exactly as the field expects.

It wasn't like that before. If you gave it an ISO date, it would always work (since the ISO date format, YYYY-MM-DD) is the system default.

Anyway, I tried matching the date exactly, and that did NOT work.

NEVERMIND. You have to use the dateFlip XMLImporter helper (which is included) under the PHP Function field. XMLImporter field

When importing dates, it's expecting ISO date and time so it will accept...

2011-05-21

or

2011-05-21T11:35

So when importing a typical date field from symphony...

<event-start-date time="16:00" weekday="7">2011-06-12</event-start-date>

You would import the date field like this, your XPath and PHPFunction for the XML Importer would be...

XPath: concat(event-startdate/text(),'T',event-start-date/@time)

PHP Function: XMLImporterHelpers::dateFlip

@buzzomatic - Can we add the an example for date use to the README file?

Found a bug... Any date with the year lower than 1901, it won't go below that. I have a list of states with the date founded... being in the 1700's or the 1800's and it won't import the dates, but changes the year to 1901.

Do you know where this default is? Can the default be changed?

I posted a bug report here.

NOTE: Looks like it's a bug with PHP.

Uncaught TypeError: Object # has no method 'symphonyDuplicator'

Has anyone come across the above error when running xmlimporter 1.0.0 (commit: d2e3a61debe109151129bd5aa108439e70f1b442)?

I'm running it on Symphony CMS 2.2.1.

This happens in Chrome, Safari, Firefox, and Opera (don't know about IE) on this page: /symphony/extension/xmlimporter/importers/new/

RESOLVED: The solution to this problem can be found at position #286 on this thread.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details