Basic configuration

Last updated on
30 April 2025
Feed Items
These are content types which you wish to use for displaying the content from the feed. The feed items should contain all the fields you wish to represent on your site. In the following example, job is the feed item.
Feed Processor Node
This is a content type used by the Feeds Processor. In the following example, xml job feed is the feed processor node.

Step 1: Download 4 modules: Feeds, Job Scheduler, Features, Feeds XPath Parser (or Feeds Ex).
Step 2: Enable the following modules: Feeds, Feeds Admin UI, Job Scheduler [required by Feeds], Feeds News [requires Features], Features, Feeds XPath Parser.
Step 3: Set up two new content types: one for the Feed Items, one for the Feed Processor. For example if we were importing an XML list of jobs, we would create these content types:
- job
- xml job feed
Step 4: Add additional fields to the feed item content type. For example, to add a 'salary' field, I would add a number or text field to the job content type named field_salary.

You are now ready to configure your feed importer.

Step 5: Create a new importer. You can navigate there by going to Admin - Site Building - Feed Importers (D6) or Structure - Feeds Importers (D7). Give it a name and description. In this example 'Jobs XML Feeds'.
Step 6 : Configure your new importer:

Basic settings

  • Settings
  • Attached to: Select your content type for feeds processor, e.g. xml job feed. (Make sure you don't select the type of content you want the feed create)
  • For testing make sure check Import on submission so you can see results *

Fetcher

  • Settings

HTTP Fetcher

  • For testing purposes, it may be worth using File Upload.

Parser

  • Select: XPath XML parser

Processor

  • Node Processor Settings - This is where you select the Feed Processor Node you want feeds to create to hold the content it imports. In this example job.
  • Mapping - For each XML field you want mapped choose XPath Expression from the Source Drop down and select a destination in the Target drop down.

At this point, we are marking what fields will later accept an XPath mapping. These mappings will be configured later.

Now its time to create your feed.

Step 7: Create the content you want to process with the feed processor, in this case xml job feed. Give it any name. Now analyze the XML of your feed to determine it's structure.

<?xml version="1.0"?>
<jobs>
   <item>
      <title>XML Developer</title>
      <src url="http://www.here.com">Here.com</src>
      <salary ccy="usd">50,000</salary>
      <salary ccy="gbp">30,000</salary>
      <publish_date>Tue, 06 Oct 2010 15:21:48 +0000</publish_date>
      <description>A job creating applications with XML.</description>
   </item>
   <item>
      <title>Drupal Developer</title>
      <src url="http://www.there.com">There.com</src>
      <salary ccy="usd">60,000</salary>
      <salary ccy="gbp">40,000</salary>
      <publish_date>Tue, 07 Oct 2010 15:21:48 +0000</publish_date>
      <description>A job creating applications with Drupal.</description>
   </item>
</jobs>

Step 8: Create XPath Mapping
To map the fields your Drupal feed processor node would look something like:

context:  //item 
title: title
body: description
url: src/@url
field_salary: salary[@ccy="usd"]

There are two ways to create mappings:

  • Create the mapping at the time of importing data from the feed. In Drupal, the basic control structure is a Node. Feed Importation is triggered by creating a Feed Processor Node (xml job feed). Every time a Feed Processor Node is created, the mappings need to be re-entered. This has the advantage of allowing you to tweak the mappings until you're satisfied with the results.
  • Create the mapping while configuring the Feed Importer. Hardcode the mapping in the Importer's Parser settings. See F.A.Q. for more information.

There are two paths to trigger the creation of a Feed Processor Node:

  • Go to the Import page (a link is on the list of Importers)
  • Select the Feed Processor Node (xml job feed) you wish to use to trigger importation. This will take you to the Create xml job feed page.

  • or go directly to the Content creation page and create the Feed Processor Node (xml job feed)

On the Create xml job feed page, go to the FEED section and enter in the above XPath Mappings. Notice there are debug settings in the XPATH PARSER OPTIONS section. Load your XML file.

Step 9: Save the Feed Processor Node. This starts the importation process. (In Drupal 6, save and then click on the import tab and click 'Import')

Your feed should have created two new job nodes, populated with the correct data. You can view them by going to the Content Page and looking for the most recently added content.

More questions?

Check out the F.A.Q..

*I spent quite sometime thinking something was wrong with my XML since every time I uploaded a file it said nothing imported but no errors. Finally I checked this box and it all just worked.

Help improve this page

Page status: Not set

You can: