Closed (fixed)
Project:
Feeds XPath Parser
Version:
7.x-1.0-beta1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Reporter:
Created:
19 Jan 2011 at 10:15 UTC
Updated:
7 Sep 2011 at 08:28 UTC
Even with the unique target set (using the example of http://drupal.org/node/845018) I have duplicate content created.
Source 'link' (mapping to URL) is set to unique.
When debugging the code, I found that every item processed contains all the settings of the other items too. For example, the feed contains 10 items, and the URL field of the first item is passed this array of values:
xpathparser:0:
<link>http://shop.flightoftheconchords.co.nz/node/16</link>
<link>http://shop.flightoftheconchords.co.nz/node/15</link>
<link>http://shop.flightoftheconchords.co.nz/node/14</link>
<link>http://shop.flightoftheconchords.co.nz/node/13</link>
<link>http://shop.flightoftheconchords.co.nz/node/12</link>
<link>http://shop.flightoftheconchords.co.nz/node/11</link>
<link>http://shop.flightoftheconchords.co.nz/node/10</link>
<link>http://shop.flightoftheconchords.co.nz/node/9</link>
<link>http://shop.flightoftheconchords.co.nz/node/8</link>
<link>http://shop.flightoftheconchords.co.nz/node/5</link>
Maybe later on the uniqueness test then fails because of this?
Comments
Comment #1
podox commentedI have the same issue. Here is my feed:
Context is set to:
//channel | //itemand mapping settings are:I get two nodes created, but both have the title of "Array". I see from the debug code that this is the same issue as the original post.
The channel title is of course mapped correctly because there is only one. The item titles and guids are imported successfully if I set the context to //item and map: title -> node title, but then I lose the ability to also map the channel title.
Comment #2
podox commentedHmm, okay so I've fixed my problem. I use
//itemas the context which solves the Array problem, and then useancestor::channel/titleto grab the channel title.So I'm unsure whether the initial error was due to my abuse of XPath or whether this is an underlying bug.
Comment #3
twistor commented@pvhee,
Things have changed a bit since that guide. Things are simpler now, but not backwards compatible sadly.
context: //item
description: description
price: g:price
etc.
The result you are getting is because //link returns all of the links in the document. That indeed will make the save fail since it can only take one result. Hope that helps!
Comment #5
epawel commentedI think I had similar problem. In my case the solution was to delete old records from feeds_source table in Drupal database. I noticed that I used only 10 importers (in feeds_importer table) but had about 20 sources (in feeds_source table). It was the reason that some records were duplicated. Finally I left only one source for one importer and it started working fine.