-2

How to read RSS Feed by using Java Script.

As I am Android developer I am very new In Java Script I have basic knowledge That's why I have not tried any thing.

I just want to know is this possible to do by javascript if yes then any one please give me the basic idea so that I will start.

Below is my code that I have tried. But it is not working.

function latestQuaterly()
{
 alert("Onclick Event is occur");
 com.myjavatools.xml.Rss rss = new com.myjavatools.xml.Rss(new java.net.URL("http://219.64.5.9/androidwebservice/RssFeed.aspx?linkname=annualreport";)); 
 int increment = 0; 
 for (java.util.Iterator i = rss.getItems().iterator(); i.hasNext();)
  { 
    if (increment > 1) { 
        break; 
        } 
        increment++; 
        com.myjavatools.xml.Rss.Item item = (com.myjavatools.xml.Rss.Item) i.next();
   }
   alert("count is :"+increment);
 }

In side the the RSS feed their is Title, Description and link I want to retrieve that separately .

4
  • stackoverflow.com/questions/6929510/… Commented Feb 21, 2012 at 11:07
  • 1
    The very first step should always be Googling. Questions like this always have thousands of good resources available for those who search. E.g. javascript parse RSS seems to yield good results. If you run into problems working with those, that will then be a good Stack Overflow question Commented Feb 21, 2012 at 11:09
  • @Pekka Thanks a lot for your Information.... I don't know that..... Commented Feb 21, 2012 at 11:14
  • 1
    That code looks like it starts out as JavaScript then tries to be Java, then goes back to JavaScript. You can't switch languages like that. Commented Feb 21, 2012 at 11:58

1 Answer 1

1

if you want to do it in jsp file, you can write java code inside scriptlet tag and use the java rss library ----http://www.myjavatools.com/projects/v.1.4.2/xml/doc/com/myjavatools/xml/Rss.html

The library provide methods to read all feeds from the given url and supported methods to display each feed seperately.

Sign up to request clarification or add additional context in comments.

5 Comments

@ChrisW Thanks a lot for your information. do you have any solution for Javascript. on the above question that I have asked. or you have just read the Tags.
here is the scriptlet code we are using in our application <% com.myjavatools.xml.Rss rss = new com.myjavatools.xml.Rss(new java.net.URL("xxx.com/feed/")); int increment = 0; for (java.util.Iterator i = rss.getItems().iterator(); i.hasNext();) { if (increment > 1) { break; } increment++; com.myjavatools.xml.Rss.Item item = (com.myjavatools.xml.Rss.Item) i.next(); %>
given url is dummy one. pls use ur feed url there
@mini I am developing the android application. In that HTML5 and Java script will give the support. So by using above java script code can we read the Rss Feed.
sorry i am not aware of android but we used it in java application. u may find the way here--stackoverflow.com/questions/226663/parse-rss-with-jquery

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.