Feature Request #125

Parse RSS 2.0 category 'domain' attribute

Added by ekes _ 509 days ago. Updated 405 days ago.

Status:Fixed Start:2009-03-06
Priority:Medium Due date:
Assigned to:- % Done:

0%

Category:-
Target version:1.2

Description

RSS 2.0 <category> can have one optional attribute 'domain'. It would be nice to have this available.

I've rolled a test patch, this is more an explanation of what I mean than a patch, it pops it in the scheme value:

Index: simplepie.inc
===================================================================
--- simplepie.inc    (revision 1035)
+++ simplepie.inc    (working copy)
@@ -3300,6 +3300,20 @@
             }
             $categories[] =& new $this->feed->category_class($term, $scheme, $label);
         }
+        foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'category') as $category)
+        {
+            $term = null;
+            $scheme = null;
+            if (isset($category['data']))
+            {
+                $term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
+              if (isset($category['attribs']['']['domain']))
+              {
+                  $scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
+              }
+              $categories[] =& new $this->feed->category_class($term, $scheme, null);
+      }
+        }
         foreach ((array) $this->get_item_tags('', 'category') as $category)
         {
             $categories[] =& new $this->feed->category_class($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null);

If you're in agreement it's valid attribute etc.. I'll happily roll against what ever correct version, and with appropriate standards. I note trunk is already checking for RSS2 rather than parsing all categories, but isn't looking at the attributes.

simplepie.inc.20090307.patch (2 KB) ekes _, 2009-03-07 06:15

Associated revisions

Revision 1045
Added by Geoffrey Sneddon 406 days ago

Get rss2:category@domain as scheme. Fixes #125.

History

Updated by ekes _ 509 days ago

FWIW I cleaned up the above to make it more like the equivalent atom code already there, and added the feed level category the same. I'm running it on a test site now.

Updated by Geoffrey Sneddon 406 days ago

  • Status changed from Unconfirmed to Fixed

Applied in changeset r1045.

Updated by Geoffrey Sneddon 406 days ago

Uh, yeah, I meant to review the patch a while ago. But then I needed it while on the train, so I coded it myself, so it is now fixed.

Updated by Geoffrey Sneddon 405 days ago

  • Target version set to 1.2

Also available in: Atom PDF