The Problem
When I set Allow source configureation override options and if I override the values in the feed node, it is not populating as default values in the xpath parser settings form on the feed node. Also the import node using the overrided configuraiton is not working.

Settings
Step 1: Under "Parser > Settings" I set up the XPath XML parser context and queries and select "Allow source configuration override".

Step 2: I created feed nodes and override some xpath query.

Step 3: I then save the feed node.

If I edit the feed node again, the values in the configuration is empty. Also I get errors like
in_array() expects parameter 2 to be array, null given in /sites/all/modules/feeds_xpathparser/FeedsXPathParserDOMXPath.inc on line 58. when imporitng feed.

Debug Information
When debugging this I found that the the configuration from is saved in to the db as

array (
  'FeedsHTTPFetcher' => 
  array (
    'source' => 'http://the-site.com/rss.xml',
  ),
  'FeedsXPathParserXML' => 
  array (
    'xpath' => 
    array (
      'context' => '//item',
      'sources' => 
      array (
        'xpathparser:0' => 'title',
        'xpathparser:1' => 'description',
        'xpathparser:2' => 'dc:creator',
        'xpathparser:3' => 'enclosure/@url',
        'xpathparser:4' => 'guid[@isPermaLink="false"]',
        'xpathparser:5' => 'pubDate',
      ),
      'rawXML' => 
      array (
        'xpathparser:0' => 0,
        'xpathparser:1' => 0,
        'xpathparser:2' => 0,
        'xpathparser:3' => 0,
        'xpathparser:4' => 0,
        'xpathparser:5' => 0,
      ),
      'exp' => 
      array (
        'errors' => 0,
        'debug' => 
        array (
          'context' => 0,
          'xpathparser:0' => 0,
          'xpathparser:1' => 0,
          'xpathparser:2' => 0,
          'xpathparser:3' => 0,
          'xpathparser:4' => 0,
          'xpathparser:5' => 0,
        ),
      ),
    ),
  ),
); 

see the xpath in the key.

But in the function parse() and function sourceForm expecting the config array with out the xpath key.

When I add

if (isset($source_config['xpath'])) {
      $source_config = $source_config['xpath'];
}

to both the functions, it works.

I'm not sure whether this is the right way to fix the issue. I found a similar issue https://drupal.org/node/1914014 But I'm not using the modules specified in that ticket. I'm using feeds with feeds xpath parser and image grabber.

I'm using Drupal 6.28 with Feeds xpath parser 6.x-1.12 and feeds 6.x-1.0-beta13

I've attached the modification I made in code as a patch. I'm not sure whether this is the right way to fix this. Please gudie me.

Thanks,

Comments

twistor’s picture

Status: Active » Closed (fixed)

This was fixed a while ago. Will make a new release soon.