I have few questions:
1) how to add a namespace ?
2) how to specify additional elements ?
See the example below:

<?xml version="1.0" encoding="utf-8" ?>
<rss xmlns:g="http://   1) HOW TO SET A NAMESPACE HERE ?  " version="2.0" xml:base="http://localhost/test">
  <channel>
    <title>this is the basic option title</title>
    <link>http://localhost/testrss</link>
    <description>this is the RSS description on the style setup</description>
    <language>it</language>
    <item>
      <title>Item 1 title</title>
      <link>http://localhost/content/test1</link>
      <description>test description</description>
      <g:id>           2) THESE ELEMENTS                        </g:id>
      <g:condition>     ARE ADDITIONAL                          </g:condition>
      <...>            (AND SHOULD BE CONFIGURABLE)  </...>
    </item>
    <item>
... item2... item3...

Thanks In Advance !

Comments

edunn’s picture

If you don't mind hacking the plugin a little bit, you can add whatever fields you want in views_plugin_style_rss_fields.inc at line 91 where it says function xml_fields(){

mine looks like this now:

  function xml_fields() {
    return array(
      'item sdImg' => array(
	    'title'=> t('Roku Thumbnail'),
		'description' => t('Roku Thumbnail element'),
	  ),
	  'title' => array(
        'title' => t('Title'),
        'description' => t('RSS 2.0 title element'),
      ),
	  'contentID' => array(
	    'title'=> t('Roku Content ID'),
		'description' => t('Roku content ID'),
	  ),
	  'contentType' => array(
	    'title'=> t('Roku Content Type'),
		'description' => t('Roku content type element'),
	  ),
	  'contentQuality' => array(
	    'title'=> t('Roku Content Quality'),
	    'description' => t('Roku content element SD or HD'),
	  ),
	  'streamFormat' => array(
	    'title'=> t('Roku Stream Format'),
	    'description' => t('Roku Stream Format'),
	  ),
	  'streamQuality' => array(
	    'title'=> t('Roku video quality'),
	    'description' => t('Roku video quality'),
	  ),
	   'streamBitrate' => array(
	    'title'=> t('Roku video bitrate'),
	    'description' => t('Roku video bitrate'),
	  ),
	   'streamUrl' => array(
	    'title'=> t('Roku video url'),
	    'description' => t('Roku video url'),
	  ),
	  'synopsis' => array(
	    'title'=> t('Roku synopsis'),
	    'description' => t('Roku synopsis'),
	  ),
		'genres' => array(
	    'title'=> t('Roku genres'),
	    'description' => t('Roku genres'),
	  ),
	   'runtime' => array(
	    'title'=> t('Roku runtime'),
	    'description' => t('Roku video quality'),
	  ),
      'description' => array(
        'title' => t('Description'),
        'description' => t('RSS 2.0 description element'),
      ),
      'link' => array(
        'title' => t('Link'),
        'description' => t('RSS 2.0 link element'),
      ),
      'author' => array(
        'title' => t('Author e-mail'),
        'description' => t('RSS 2.0 author element'),
      ),
      'dc:creator' => array(
        'title' => t('Author name'),
        'description' => t('Dublin core creator element'),
      ),
      'category' => array(
        'title' => t('category'),
        'description' => t('RSS 2.0 category element'),
      ),
      'guid' => array(
        'title' => t('guid'),
        'description' => t('RSS 2.0 guid element'),
      ),
      'pubDate' => array(
        'title' => t('pubDate'),
        'description' => t('RSS 2.0 pubDate element'),
      ),
	  'media:copyright' => array(
	  	'title'=> t('copyright'),
		'description' => t('Rss 2.0 Copyright element'),
	  ),
	  'media:thumbnail' => array(
	  	'title'=> t('Thumbnail'),
		'description' => t('Rss 2.0 Thumbnail element'),
	  ),
	  'boxee:media-type' => array(
	  	'title'=> t('Boxee Media Type'),
		'description' => t('Boxee Media Type element'),
	  ),
	  'media:content' => array(
	    'title'=> t('Media Content'),
	    'description' => t('Media Content URL element'),
	  ),
	  'boxee:release-date' => array(
	  	'title'=> t('Boxee Release Date'),
		'description' => t('Boxee Release Date element'),
	  ),
	  
    );
  }
mandreato’s picture

Thanks edunn, I'll give it a try

maciej.zgadzaj’s picture

Status: Active » Closed (fixed)

Just pushed new 6.x-1.x-dev version, providing hook_views_rss_elements_alter($elements) for adding new user-defined fields.

Also, when new fields are added, and if new namespaces are to be configured, they will automatically appear in view's style settings (Feed settings / XML namespace definitions).

Please pull new version from repository or allow up to 12 hours for d.o to regenerate downloadable package.

mandreato’s picture

Thank you maciej.zgadzaj !
I've created a module to extend Views RSS for Google Merchant Center feed format as suggested in http://drupal.org/node/1346506, then specified the URI for "g" namespace (http://base.google.com/ns/1.0). Finally assigned a field to "Google Merchant Center product ID" RSS Feed field.
The generated XML shows all the informations, but misses the namespace (xmlns=...).

mandreato’s picture

Status: Closed (fixed) » Needs review

Here is how to show the missing namespace: on views_plugin_style_rss_fields.inc at line 329, add the following:

      elseif (isset($this->options['feed_settings']['namespaces'][$local])) {
        return array(
          'local' => $local,
          'namespace' => $this->options['feed_settings']['namespaces'][$local],
        );
      }

Hope This Helps !

maciej.zgadzaj’s picture

Status: Needs review » Postponed

Just a quick update on this - I am not committing this patch, and rather not going to, as at the moment I am in the progress of a huge refactoring, adding new features and fixing existing issues (including this one) - probably when the version I am working on becomes more or less usable I will just release it as 2.0-dev...

druth’s picture

Having the same issue adding namespaces, mandreato I used the code from #5 and after a cache clear the namespaces are still not appearing, did you have to make any other modifications?

mandreato’s picture

@druth_hpl, I don't use this module anymore but, as far as I can remember, #5 was the only modification I did to have the namespaces on 6.x-1.x-dev.

abudev’s picture

I used the code from #5 too and the namespaces are still not appearing...Some other solution?

PHLAK’s picture

I tried the fix suggested in #5 but that didn't seem to help. Is there any more information or status on a fix?

maciej.zgadzaj’s picture

I have just pushed new 6.x-2.x-dev version, which should resolve your issues.

It provides 3 new hooks: hook_views_rss_channel_elements_alter($elements), hook_views_rss_item_elements_alter($elements) and hook_views_rss_namespaces_alter($namespaces), through which other modules can modify existing or define new <channel> and <item> elements as well as any extra required namespaces.

These hooks are used by 3 additional sub-modules coming together in the package: views_rss_core (providing basic set of channel and item elements, needed for the feed to be created at all), views_rss_dc (Dublin Core elements) and views_rss_georss (GeoRSS elements).

Please note that it is still under development, so things still could change, most main features should work fine though. I would love to get some feedback if any of you guys feel like giving it a test run and letting me know your thoughts.

maciej.zgadzaj’s picture

Status: Postponed » Closed (fixed)