shuva mallick
shuva mallick

Reputation: 549

RSS item elements not being not being read by XML Reader

I don't know if i am asking this correctly but plz help me.

I am using Drupal Views to display RSS for my site. I am using the 'Views RSS: Core Elements' module to map the RSS fields with the custom fields added by me in the views. All works well. But a requirement forces me to add custom item elements in the RSS display. I am implementing the hook_views_rss_item_elements() to add custom item elements. When i view the RSS page i get the see the custom items but when i try to read the RSS using a RSS reader, the items are not being read. What am i doing wrong, or am i missing something?

Here is my code to add custom items to the 'SHOW ITEM ELEMENTS : CORE' for RSS display:

function Mymodule_views_rss_item_elements() {   
$elements['blogs_title_image'] = array ( 'title' => t('Blogs Title Image'), 'description' => t('Blogs Title Image'), );  
$elements['blogs_additional_tags'] = array ( 'title' => t('Blogs Additional Tags'), 'description' => t('Blogs Additional Tags'), );  
$elements['blogs_short_desc'] = array ( 'title' => t('Blogs Short Description'), 'description' => t('Blogs Short Description'), );  

return $elements;  
}

Upvotes: 1

Views: 81

Answers (1)

shuva mallick
shuva mallick

Reputation: 549

After some research i did manage to find my way out: I implemented hook_views_rss_namespaces to add a custom namespace and the custom items under the namespace:

function Mymodule_views_rss_namespaces() {  
  $namespaces['blogs'] = array(
  'prefix' => 'xmlns',
  'uri' => 'http://base.google.com/ns/1.0',
);
return $namespaces;
}

Note: Use the same 'prefix' and 'uri' as given in the above code or else namespace uri error will arise.

Upvotes: 1

Related Questions