My question has to do with mapping custom fields that use a non-standard namespace prefix. We’re using Drupal 6, Feeds 6.x-1.0-beta12 and Feeds XPath Parser 6.x-1.12+3-dev.

We’re trying to read feed items into Drupal as nodes including some prefixed custom fields. We know the feed’s ok because we’ve been able to parse the fields using SimplePie in a freestanding application. But when we parse the feed using Feeds and XPath Parser, the nodes are created with the standard fields (title, description, link) but not the prefixed fields or the url attribute of the enclosure field.

Here’s the xml structure:

<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:psg="http://theclientsite.com/psg_namespace" version="2.0">
<channel>
<title>Content Distribution</title>
<link>http://theclientsite.com</link>
<description>Media Distribution Network</description>
<atom:link type="application/rss+xml" rel="self" href="http://theclientsite.com/rss/latest"/>
<item>
<title>Springfield at Arlington North Football</title>
<link>http://theclientsite.com/content/show/31</link>
<description>Springfield Crimson visits Stadium in Arlington to take on the Arlington North Titans</description>
<psg:duration>02:10:06</psg:duration>
<psg:episode>10/12/2012</psg:episode>
<psg:producer>Joe Smith</psg:producer>
<enclosure type="image/jpeg" length="5823" url="http://theclientsite.com/thumbnails/31.jpg"/>
<guid>http://theclientsite.com/content/show/31</guid>
<pubDate>Sat, 13 Oct 2012 21:33:26 -0400</pubDate>
</item>
 </channel>
</rss>

I’m using this mapping:

context: //item
Title: title
Body: description
URL: link
Duration field: psg:duration
Edisode field: psg: episode
Producer field: psg: producer
Image field: enclosure/@url

When I import fresh feed items, the title, description, and link data all import fine but I can’t get it to pull in any of the prefixed custom fields or the url attribute of enclosure.

I’ve searched these forums and tried other options in terms of syntax, but nothing works. I’ve also cleared cache, checked field permissions, tried various contexts and and more. Is there anything I’m missing? On the verge of giving up but I thought I’d give this one more try.

Thanks for any insight you might have.

Comments

BrattDev’s picture

I looked at Feeds QueryPath Parser but that seemed to be like starting over, and I've got too much time invested in the XPath Parser. I'm running out of ideas here. Am I going to have to write my own module to do this using the now defunct SimplePie (just because it works). Jeez, I don't want to do that.

Anyone out there have any ideas?

BrattDev’s picture

I finally got it working today. I think it was a combination of things that was preventing the fields from importing. I double-checked the username that was being assigned as the owner of the feed item nodes in the Feeds module. Then I double-checked that that user had the ability to create feed item nodes. Then I checked the custom fields and made sure that my user had permission to edit those fields (and see them). I mention these things because I'm pretty sure it was a permissions issue that caused my problem.

Otherwise, my mapping was fine so if you have prefixed fields, you can just use those prefixed field names in your parser settings and they should be fine.

With software like this that has so many moving parts, it's easy to get lost in details. I just wanted to follow up in the event that someone else is having similar problems.

Thanks for providing me with a place to talk to myself about my problem!

BrattDev’s picture

Not sure if this was related or not, but the feeds module uses two content types by default for its default Feed importer. I had created a new test importer and it also specified those content types -- feed and feed item. Once I realized this, I disabled the default Feed importer. It was shortly after disabling this possibly conflicting feed importer that I started to get somewhere.... So in addition to permissions, having more than one feed importer that uses the 'feed' and 'feed items' content type is probably not a good idea.

kreynen’s picture

While only available in D7 (could be backported) and not a general solution to prefix/custom namespace issue, the specific issue of being able to map the psg: prefixed elements can be solved by using the feeds_telvue module found in http://drupal.org/project/telvue

twistor’s picture

Status: Active » Closed (fixed)

Closing out old issues. If you're still having this problem, feel free to re-open it.