[Drupal] How to create a feed importer and select the Fetcher as HTTP Fetcher?

By | 07th Feb 2015 | 2 min read

I had a requirement in one of my Drupal site in which I want to import content from an external XML file generated from another website.
The XML generated as a URL say For ex: http://example.com/feed.xml, I want to fetch the XML every time from the above generated URL. Follow the below steps to fetch the XML from URL's:

Use the following modules to import feeds
Feeds XPath Parser

After enabling modules, create a feed importer for the particular content type

Following is the steps to create feed importer:
1. Set attach to content type as standalone form (refer image1).
2. Select fetcher as HTTP Fetcher
3. Select the parser XPath XML parser(select which one you want ,here am using XPath XML parser) refer image2.
4. Select a processor eg: Node processor
5. Save the settings for Node processor (refer image3).
a) Select bundle as which content type you need to import (eg: page).
b) Set all other options their about the expiration, updating < author.

6. Then create the mapping (refer image4).
a) select xpath parser and mapping field of the content type

  • xpathparser:0 as GUID
  • xpathparser:1 As Title
  • xpathparser:2 as URL

b) Set GUID field as unique(note: you can use any other fields also as unique like email)
7. Map the settings for XPath XML parser(refer image5).

for example

<?xml version="1.0" encoding="utf-8"?>

So the mapping should like
Context : //page
GUID : id
Title : title

That it , now you can import the data via, http://example.com/import (refer image6).

Note :
a) please give the URL where XML exist in importer
b) The id in the above XML should be unique