Firstly, many thanks for this incredible module it really is one of the things which makes drupal so powerful!

I have noticed that our RSS feeds are not validating due to extra namespaces being added to the <RSS> element.

http://www.oxfordshire.gov.uk/cms/feeds/top-stories.xml

The start of the feed looks as follows:

<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="http://www.oxfordshire.gov.uk/cms/feeds/top-stories.xml" xmlns:dc="http://purl.org/dc/elements/1.1/" content="http://purl.org/rss/1.0/modules/content/" dc="http://purl.org/dc/terms/" foaf="http://xmlns.com/foaf/0.1/" og="http://ogp.me/ns#" rdfs="http://www.w3.org/2000/01/rdf-schema#" sioc="http://rdfs.org/sioc/ns#" sioct="http://rdfs.org/sioc/types#" skos="http://www.w3.org/2004/02/skos/core#" xsd="http://www.w3.org/2001/XMLSchema#">

The additional namespaces all seem to be due to having RDF enabled. I have tried searching through the views settings and drupal site settings but can't see anything which looks relevant to fixing this.

in the default views-views-rss.tpl.php template file I can see where it grabs all the namespaces

<rss version="2.0" xml:base="<?php print $link; ?>"<?php print $namespaces; ?>>

I am just wondering if this is the expected behaviour for this, or whether the views RSS display or the RDF module should be deciding what namespaces are available depending on what is being rendered.

I presume a work around for this would be to just create a views-views-rss.tpl.php for my own theme to over-ride it.

Thanks for any advice!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

scor’s picture

Status: Active » Needs review
FileSize
931 bytes

@johntarling could you try this patch and see if it validates please?

For the records, this code was introduced in #1301788: RSS Feed - Title plus teaser --- still grabs default node view?.

dawehner’s picture

Status: Needs review » Needs work

This patch seems to be against views 3.1 and not views 3.x-dev, because the patch doesn't apply anymore.

johntarling’s picture

Status: Needs work » Needs review
FileSize
990 bytes

@scor Many thanks for the patch, i applied the code manually against my dev branch and the feed seems to be correctly generated.

The only issue which stops it fully validating is the namespace for dublin core terms (dc) being set to one which the validators aren't expecting. I can see you have discussed the reasoning for the namespace being set to that here http://drupal.org/node/994592#comment-4567482 in the RDF module. I assume it is just a case of waiting for the validators updating their expected namespaces to the new one.

I have re-rolled the patch against the current dev branch and it should be ready to test.

Jim Ruby’s picture

I applied this patch against the latest dev dated 02-22-2012 and still receive the error, the link I use is:
http://access.v-community.com/taxonomy/term/16/all/feed
I used the validation service:
http://validator.w3.org/feed/

I am still seeing errors, rather then paste the entire thing here as it is all greek to me I just gave the links I used above.

If there is another place I should verify or test the feed for better results, let me know.

scor’s picture

Thanks for testing @johntarling and @Jim Ruby. ok, we shouldn't override the default rss namespaces.

Jim Ruby’s picture

Ok, this one worked using patch in 5
validater
http://validator.w3.org/feed/
feed:
http://access.v-community.com/taxonomy/term/16/all/feed
but I still received:
Recommendations
This feed is valid, but interoperability with the widest range of feed readers could
be improved by implementing the following recommendations.
line 1
, column 39: Use of unknown namespace: http://ogp.me/ns# [
help
]
<?xml version="1.0" encoding="utf-8" ?> ^
line 1
, column 39: Use of unknown namespace: http://rdfs.org/sioc/ns# [
help
]
<?xml version="1.0" encoding="utf-8" ?> ^
line 1
, column 39: Use of unknown namespace: http://rdfs.org/sioc/types# [
help
]
<?xml version="1.0" encoding="utf-8" ?> ^
line 1
, column 39: Use of unknown namespace: http://www.w3.org/2004/02/skos/core# [
help
]
<?xml version="1.0" encoding="utf-8" ?> ^
line 1
, column 39: Use of unknown namespace: http://www.w3.org/2001/XMLSchema# [
help
]
<?xml version="1.0" encoding="utf-8" ?> ^
line 11
, column 0: description should not contain property attribute (15 occurrences) [
help
]
<div class="field-item even" property="content:enc ...
line 206
, column 2: Missing atom:link with rel="self" [
help
]

^

johntarling’s picture

The patch in #5 seems good to me too. I am getting the same sort of recommendations but the feed is valid.

I'd suggest this can probably be set to RTBC now as it seems quite a small change but i'll leave that to someone more experienced with drupal patch checking!

Thanks again scor

tim.plunkett’s picture

Category: support » bug
Status: Needs review » Reviewed & tested by the community
FileSize
1.06 KB

Rerolled for coding style, commit credit goes to scor.

scor’s picture

ah! I thought Views had its own coding style that's why I left that elseif untouched. maybe that has changed, would be curious to know...

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

I think views has no different coding style, but the one from core,
even i personally don't like "elseif". Just the fact that you can't use that in javascript is such a mess.

Thanks for the patch. Committed to 7.x-3.x

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Jim Ruby’s picture

This is still not working right using rss formatter module too
If I can get some more help on this I sure would appreciate it:

I received this feed back and I am using the pach so the feed validates fine
in my content type display rss I have
file
Label display for file
Above
Formatter for file
RSS enclosure
Archives
Label display for Archives
Above
Formatter for Archives
RSS category

I am still getting feed back saying they can't get the files.

The reason this podcast says it is an unsupported format is that it is a straight RSS feed, not an RSS feed with enclosures.

You can add the feed URL to an RSS reader to be notified when new articles are posted, but since the links to the audio files are embedded in the body of the aricle and not linked as "attachments" BPP, nor any other podcast client unless it can parse the description tag for links, will be able to automatically download the files.

As of recently, when you try to update the podcast feed, you are told it's an unsupported format. Here's the feed if you want to give it a try:
Tek Talk Archives Url http://accessibleworld.org/taxonomy/term/16/all/feed

scor’s picture

@Jim Ruby what module are you referring to? http://drupal.org/project/rss_field_formatters ?

Jim Ruby’s picture

Yes
http://drupal.org/project/rss_field_formatters
is the module, so should I re post this over there? as it seemed to be working fine before RDF namespaces got mest up as far as I can tell.

scor’s picture

@Jim Ruby yes please create an issue against that module explaining step by step how to reproduce the problem, and I'll try to take a look.

Jim Ruby’s picture

I have created it, you can find it at:
feed validation does not see enclosures
http://drupal.org/node/1505362

dman’s picture

Glad to know this fix has been found!
We've got a production site going live I can't justify pushing views-dev (or views-patched) onto, so I came up with a small repair-job that runs to fix this problem ... until this patch gets a stable release.

Just thought I'd post it here for reference.


/**
 * views_plugin_row_node_rss adds
 * all site namespaces to the feed incorrectly.
 *
 * Up to (at least) "7.x-3.3" 2012-Feb-22
 *
 * I need to repair it on the way out as it's rendering views_view_row_rss
 * HOOK_preprocess_views_view_row_rss
 *
 * This gets fixed in http://drupal.org/node/1418890#comment-5691200
 **/
function HOOK_preprocess_views_view_row_rss(&$element) {
  // The problem is in the view->style_plugin->namespaces
  $namespaces = &$element['view']->style_plugin->namespaces;
  foreach ($namespaces as $prefix => $uri) {
    if (! strstr($prefix, ':')) {
      // Need to force xmlns onto the front of the prefix.
      unset($namespaces[$prefix]);
      $namespaces['xmlns:' . $prefix] = $uri;
    }
  }
}

Sorry for the bump on a closed issue, but until the patch has gone into a release, this bug is still active in the wild.

Jim Ruby’s picture

I do not understand this, but sure could use the fix. would it be in the dev release yet?

scor’s picture

yes, that fix is in the current dev release that you can download from http://drupal.org/node/608852

cornel.eftimie’s picture

I presume a work around for this would be to just create a views-views-rss.tpl.php for my own theme to over-ride it.

why not?

cornel.eftimie’s picture

Issue summary: View changes

added code tags around rss tag