function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Trinath ReddyTrinath Reddy 

How to write the lightning component and controller for the below Apex class

I need to display title,URL and pubDate

public class RSSNewsReader {
    public String rssQuery {get;set;}
    private String rssURL {get;set;}
    public String displayMessage { get; set; }
   
    public RSSNewsReader() {
    
    User Usr = [SELECT UserRole.Name FROM User WHERE Id = : UserInfo.getUserId()];
         system.debug('Usr.UserRole.Name'+ Usr.UserRole.Name);
         
         if(Usr.UserRole.Name=='CEO'){
         displayMessage='Google-News';
        rssURL = 'URL link';
    }
    else if(Usr.UserRole.Name=='CFO'){
         displayMessage='Times of India-News';
         rssURL = 'URL link';
    
    }
    }@AuraEnabled
    public RSS.channel getRSSFeed() {
        return RSS.getRSSData(rssURL);
    }
}
------------------
public class RSS {
    public class channel {
       public list<RSS.item> items {get;set;}
        public channel() {
            items = new list<RSS.item>();
        }
    }
    public class item {
        public String title {get;set;}
        public String link {get;set;}
        public String pubDate {get;set;}
        public String getUrl() {
            String result = (link != null) ? link.substringAfterLast('url=') : null;
            return result;
        }
        public DateTime getPublishedDateTime() {
            DateTime result = (pubDate != null) ? DateTime.valueOf(pubDate.replace('T', ' ').replace('Z','')) : null;
            return result;
        }
    }
    public static RSS.channel getRSSData(string feedURL) {
        HttpRequest req = new HttpRequest();
        req.setEndpoint(feedURL);
        req.setMethod('GET');
        Dom.Document doc = new Dom.Document();
        Http h = new Http();
        HttpResponse res = h.send(req);
        doc = res.getBodyDocument();
        Dom.XMLNode rss = doc.getRootElement();
        //first child element of rss feed is always channel
        Dom.XMLNode channel = rss.getChildElements()[0];
        RSS.channel result = new RSS.channel();
        list<RSS.item> rssItems = new list<RSS.item>();
       for(Dom.XMLNode elements : channel.getChildElements()) {
        if('item' == elements.getName()) {
                RSS.item rssItem = new RSS.item();
                //for each node inside item
                for(Dom.XMLNode xmlItem : elements.getChildElements()) {
                    if('title' == xmlItem.getName()) {
                        rssItem.title = xmlItem.getText();
                    }
                    if('link' == xmlItem.getName()) {
                        rssItem.link = xmlItem.getText();
                    }
                   if('pubDate' == xmlItem.getName()) {
                        rssItem.pubDate = xmlItem.getText();
                    }
                }
                //for each item, add to rssItem list
                rssItems.add(rssItem);
            }
          }
            //finish RSS.channel object by adding the list of all rss items
        result.items = rssItems;
        return result;
        }
        
}