[ 
https://wso2.org/jira/browse/MASHUP-777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16428#action_16428
 ] 

Tyrell Perera commented on MASHUP-777:
--------------------------------------

Update:
------

Since our Feed object is based on a ROME SyndFeed, both Feed and Entry objects 
have a superset of properties. Depending on the type of Feed read, some 
properties will be invalid (null). The good news is that a Feed object will 
always have the 'type' property set. Therefore a Mashup author can check the 
'type' of the current Feed and treat its Feed/Entry properties accordingly.

Currently the Feed types are rss_0.90, rss_0.91, rss_0.92, rss_0.93, rss_0.94, 
rss_1.0 rss_2.0 and atom_0.3

For instance;

   http://sanjiva.weerawarana.org/feeds/posts/default [This is an Atom Feed]
   http://auburnmarshes.spaces.live.com/feed.rss [This is RSS]

When getting content the Mashup author should get the 'description' property 
from the RSS entries, while getting the 'content' property from the Atom ones.

function getFeed(url) {     
    var reader = new FeedReader();     
    var feed = reader.get(url);
    
    if(!(feed.type.indexOf("rss") == -1))
      return feed.getEntries()[0].description;
    elseif(!(feed.type.indexOf("atom") == -1))
      return feed.getEntries()[0].content;
    else
      return "";
}


Some properties will return null depending on the Feed type and they are now 
handled (ref: MASHUP-778) to prevent 'null pointer' exceptions poping up at the 
backend.

If this is acceptable we can leave it at this. If not I can add a new method, 
such as getPayload(), which will get the contents no matter what the feed type 
is.

> Feed doesn't normalize content vs. description.
> -----------------------------------------------
>
>                 Key: MASHUP-777
>                 URL: https://wso2.org/jira/browse/MASHUP-777
>             Project: WSO2 Mashup Server
>          Issue Type: Bug
>            Reporter: Jonathan Marsh
>            Assignee: Tyrell Perera
>             Fix For: 1.1
>
>
> I have trouble using the Feed object to normalize the differences between 
> these two URLs:
>    http://sanjiva.weerawarana.org/feeds/posts/default
>    http://auburnmarshes.spaces.live.com/feed.rss
> The former holds content in the "content" property, the latter holds it in 
> the "description" property.  Can we normalize these two so we can get the 
> content despite what format the feed is in?
>    

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://wso2.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to