I have a content type in Drupal 6 wiht a title and an image in an imagefield. I have exported the nodes to an xml file.
I made the same content type in Drupal 7 and want to import the nodes.
A record of my xml file from Drupal 6 is like this:
<nodes>
<node>
<Titel>Madese Boys</Titel>
<Shirt><img class="imagefield imagefield-field_verenigingsshirt" width="24" height="21" alt="" src="http://localhost/sites/default/files/made.gif?1301332564" /></Shirt>
<Nid>35</Nid>
</node><nodes>
The import works when I only choose the field "Titel".
When I add the field "Shirt" the import does not work, The images are in "http://localhost/sites/default/files/"
The xml output of two records of the contenttype in Drupal 7 is:
<?xml version="1.0" encoding="UTF-8" ?>
<nodes>
<node>
<Titel>Madese Boys</Titel>
<Shirt><img typeof="foaf:Image" src="http://localhost/vvwd7/sites/default/files/made.gif" width="24" height="21" alt="" /></Shirt>
<Nid>35</Nid>
</node>
<node>
<Titel>Uno Animo</Titel>
<Shirt><img typeof="foaf:Image" src="http://localhost/vvwd7/sites/default/files/unoanimo.gif" width="24" height="21" alt="" /></Shirt>
<Nid>36</Nid>
</node>
</nodes>
I added "FeedImportFilter::getProperty" to the filter and put 'src' on the second line function params
I get an error nr.8 on line 220 of modules\file\file.field.inc:
Trying to get property of non-object
Thanks for any help.
Comments
Comment #0.0
PvO commentedadded Drupal 7 xml output of records of the content type and the filter FeedImportFilter::getProperty
Comment #0.1
PvO commentedadded 'Drupal 6" on mentioning first time xml
Comment #1
Sorin Sarca commentedHi,
You cannnot get src property because "img" is a content in "Shirt" tag (you must use < and > not
<and>).So, you have to replace all instances of
<with < and>with >. Finally your xpath to src property will look something likeShirt/img/@src(don't forget that xml tags are case-sensitive) and then you can use ::getProperty in filters.Instead of this:
<Shirt><img typeof="foaf:Image" src="http://localhost/vvwd7/sites/default/files/made.gif" width="24" height="21" alt="" /></Shirt>use this:
<Shirt><img typeof="foaf:Image" src="http://localhost/vvwd7/sites/default/files/made.gif" width="24" height="21" alt="" /></Shirt>Hope this helps you.
Comment #2
flymatic commentedHi,
i have similar issue with display of images from my xml feed.My setup is drupal 7.10 clean installation and feed_import 2.2. I created content type with couple of fields - title, body ,image. Image field in content type is with field "image" and widget type of "image".
My xml file looks like this:
When i import only "title" and "body" fields everything works perfect. The problem arise when I try to map image field of element from my xml file.I did a couple of "trial and error" attempts, i added different filters to image field mapping, but with no luck.
I get an error 8 on line 220 of modules\file\file.field.inc:
Trying to get property of non-object
Could someone give me a hint or maybe I'm doing something wrong.
thanx
Comment #3
Sorin Sarca commentedHi,
to save image you must use a filter for your field. Take a look at this example http://drupal.org/node/1360374#import-html.
This is for image field:
Comment #4
flymatic commentedThank you for your prompt response.
Now everything work fine:).
Thanks once again.
Comment #5
Sorin Sarca commentedComment #5.0
Sorin Sarca commentedadded error 8