Somehow I have to scan an RSS feed. Sounds simple enough using a scanner. But then I have to break that feed down into 15 different objects. More specifically, I have to use slashdot.org's news feed and make 15 news objects out of them. Thats not all I have to do but before I get into the rest of the project I need to know how to do this. Thanks
Originally posted by mike pa: bad news; i have to scan through it myself.
Why? Is this some kind of homework?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Oct 16, 2006
project for school
i created a new url object URL url = new URL("http://www.slashdot.org/index.rss"); and tried saying Scanner scan = new Scanner(url);
i imported the java.net.URL package but still get an error. my instructor said make sure i'm importing the proper package, which i believe i am. the error i'm getting says Driver.java:16: cannot find symbol symbol : constructor Scanner(java.net.URL) location: class java.util.Scanner Scanner scan = new Scanner(url) ^
all other examples i see use a buffered reader or something of the sort but that is not something we have learned in class (but then again, neither is most of the project). [ October 29, 2006: Message edited by: mike pa ]
Joined: Jul 11, 2001
The compiler is telling you that it *did* find the class, but that it didn't find a constructor taking a URL as parameter.
Joined: Oct 16, 2006
does this mean I instantiated my url object wrong? i'm having one hell of a time finding examples of this.
No, it means you're instantiating the Scanner incorrectly. You need to look at the API for Scanner to see what constructors actually exist that you can use. There isn't one for URL. Note that the URL class has a method that returns an InputStream, and Scanner has a constructor that can accept an InputStream. So there's at least one way to bridge the gap between what you have (URL) and what you need (Scanner). [ October 30, 2006: Message edited by: Jim Yingst ]