Getting Enclosure Contents using Rome RSS parser

Discussion in 'Java' started by galois271@gmail.com, Apr 30, 2013.

  1. Guest

    Hi all,

    I just downloaded Rome to use in my podcast catching program. I can't seem to find any decent documentation on it. I am trying to access the podcast URLs that are located in the enclosures.

    Here is what I tried: (everything works great, but getting enclosure contents/values)

    public static void main(String[] args) throws IOException, IllegalArgumentException, FeedException
    {
    URL url = new URL("http://www.theskepticsguide.org/feed/rss.aspx?feed=SGU");
    XmlReader reader = null;

    try {

    reader = new XmlReader(url);
    SyndFeed feed = new SyndFeedInput().build(reader);
    System.out.println("Feed Title: " + feed.getAuthor());

    for (@SuppressWarnings("rawtypes")Iterator i = feed.getEntries().iterator(); i.hasNext();)
    {
    SyndEntry entry = (SyndEntry) i.next();
    System.out.println("Title: " + entry.getTitle());
    System.out.println("Description: " + entry.getDescription().getValue());
    System.out.println("Link: " + entry.getEnclosures() + '\n');

    }
    } finally {
    if (reader != null)
    reader.close();

    }
    }

    }
    , Apr 30, 2013
    #1
    1. Advertising

  2. Jeff Higgins Guest

    On 04/30/2013 11:58 AM, wrote:
    > Hi all,
    >

    I can't seem to find any decent documentation on it.
    No javadoc available? I'd really want that.
    What does getEnclosures() return? A bag/box/bunch of enclosures?
    Jeff Higgins, Apr 30, 2013
    #2
    1. Advertising

  3. Jeff Higgins Guest

    On 04/30/2013 03:10 PM, Jeff Higgins wrote:
    > On 04/30/2013 11:58 AM, wrote:
    >> Hi all,
    >>

    > I can't seem to find any decent documentation on it.
    > No javadoc available? I'd really want that.
    > What does getEnclosures() return? A bag/box/bunch of enclosures?
    >

    Maybe once you have an enclosure there is some sort of content
    extraction tool.
    Jeff Higgins, Apr 30, 2013
    #3
  4. On Tuesday, April 30, 2013 2:10:16 PM UTC-5, Jeff Higgins wrote:
    > On 04/30/2013 11:58 AM, wrote:
    >
    > > Hi all,

    >
    > >

    >
    > I can't seem to find any decent documentation on it.
    >
    > No javadoc available? I'd really want that.
    >
    > What does getEnclosures() return? A bag/box/bunch of enclosures?


    It apparently returns a List, but I can't seem to use indexes to get the members. ??
    Chuck Johnson, Apr 30, 2013
    #4
  5. Lew Guest

    Chuck Johnson wrote:
    > Jeff Higgins wrote:
    >> galois271@....com wrote:
    >>> I can't seem to find any decent documentation on it.

    >>
    >> No javadoc available? I'd really want that.
    >>
    >> What does getEnclosures() return? A bag/box/bunch of enclosures?

    >
    > It apparently returns a List, but I can't seem to use indexes to get the members. ??


    First of all, OP, don't ever do this:

    @SuppressWarnings("rawtypes") ...

    Second, give us this, please:

    http://sscce.org/

    As to docs for Rome, where have you looked so far?

    --
    Lew
    Lew, Apr 30, 2013
    #5
  6. > First of all, OP, don't ever do this:
    >
    >
    >
    > @SuppressWarnings("rawtypes") ...
    >
    >
    >
    > Second, give us this, please:
    >
    >
    >
    > http://sscce.org/
    >
    >
    >
    > As to docs for Rome, where have you looked so far?
    >
    >
    >
    > --
    >
    > Lew


    I suppressed warnings because I'm just trying to get Rome to work, and that was a way recommended by Eclipse, sort of a TDD approach: make it so it doesn't fail. I'm really only testing Rome at the moment, no serious code.
    Secondly, you have all my code, save the import statements and class declaration. Unless, you have Rome & JDOM installed, this code won't run for you. My hope is that one of you guys out there has actually used Rome before, and can help me.
    Chuck Johnson, Apr 30, 2013
    #6
  7. On Tuesday, April 30, 2013 2:58:01 PM UTC-5, Chuck Johnson wrote:
    > > First of all, OP, don't ever do this:

    >
    > >

    >
    > >

    >
    > >

    >
    > > @SuppressWarnings("rawtypes") ...

    >
    > >

    >
    > >

    >
    > >

    >
    > > Second, give us this, please:

    >
    > >

    >
    > >

    >
    > >

    >
    > > http://sscce.org/

    >
    > >

    >
    > >

    >
    > >

    >
    > > As to docs for Rome, where have you looked so far?

    >
    > >

    >
    > >

    >
    > >

    >
    > > --

    >
    > >

    >
    > > Lew

    >
    >
    >
    > I suppressed warnings because I'm just trying to get Rome to work, and that was a way recommended by Eclipse, sort of a TDD approach: make it so it doesn't fail. I'm really only testing Rome at the moment, no serious code.
    >
    > Secondly, you have all my code, save the import statements and class declaration. Unless, you have Rome & JDOM installed, this code won't run for you. My hope is that one of you guys out there has actually used Rome before, and can help me.


    The rometools link didn't help. On that site, are a bunch of dead links. :(
    Chuck Johnson, Apr 30, 2013
    #7
  8. Jeff Higgins Guest

    On 04/30/2013 04:08 PM, Chuck Johnson wrote:

    >> I suppressed warnings because I'm just trying to get Rome to work,

    and that was a way recommended by Eclipse,

    ??

    sort of a TDD approach: make it so it doesn't fail.

    TDD approach? really? I'll have to look into your no-fail approach.
    ] hadn't heard of it before.

    I'm really only testing Rome at the moment, no serious code.
    Secondly, you have all my code, save the import statements and class
    declaration.
    Unless, you have Rome& JDOM installed, this code won't run for you.

    As things stand there is no need for anyone to run the code.

    My hope is that one of you guys out there has actually used Rome before,
    and can help me.

    Hasn't sunk in yet?

    The rometools link didn't help. On that site, are a bunch of dead
    links. :(

    The frownny is funny.
    Jeff Higgins, Apr 30, 2013
    #8
  9. Lew Guest

    Chuck Johnson wrote:

    > [attribution restored: please attribute citations]
    > Lew wrote:
    >> First of all, OP, don't ever do this:
    >>
    >> @SuppressWarnings("rawtypes") ...
    >>
    >> Second, give us this, please:
    >>
    >> http://sscce.org/
    >>
    >> As to docs for Rome, where have you looked so far?

    >
    > I suppressed warnings because I'm just trying to get Rome to work,


    A) Not relevant.
    B) Not really going to do what you intend.
    C) Don't use raw types.

    > and that was a way recommended by Eclipse,


    Nonsense.

    > sort of a TDD approach: make it so it doesn't fail.


    That's rather the opposite of TDD.

    > I'm really only testing Rome at the moment, no serious code.


    Okay, not really a good reason to indulge in bad habits, but okay ...

    > Secondly, you have all my code, save the import statements and class declaration.


    "... all ... save ..." is not the same as "all".

    And I didn't ask for all your code, I asked for an SSCCE.

    > Unless, you have Rome & JDOM installed, this code won't run for you.
    > My hope is that one of you guys out there has actually used Rome before, and can help me.


    I had no troubles with the linked project site. The Javadocs downloaded just fine. DId you
    try them?

    --
    Lew
    Lew, Apr 30, 2013
    #9
  10. Roedy Green Guest

    On Tue, 30 Apr 2013 08:58:02 -0700 (PDT), wrote,
    quoted or indirectly quoted someone who said :

    >I can't seem to find any decent documentation on it


    IntelliJ Idea and presumable most other IDES have a feature to let you
    point at reference and see all the possible methods you could call on
    it. It will then show you the parms and individual method needs.
    These are invaluable for navigating through code that parses
    something.
    --
    Roedy Green Canadian Mind Products http://mindprod.com
    Nothing is so good as it seems beforehand.
    ~ George Eliot (born: 1819-11-22 died: 1880-12-22 at age: 61) (Mary Ann Evans)
    Roedy Green, Apr 30, 2013
    #10

  11. >
    > I had no troubles with the linked project site. The Javadocs downloaded just fine. DId you
    >
    > try them?
    >
    >
    >
    > --
    >
    > Lew


    I am not really sure how to use javadocs to find what I'm looking for. I don't know what class or what methods to look at. I'm pretty sure there a lots & lots of methods, so I would probably spend hours & hours looking for the right method(s). I was looking more for a wiki/tutorial, or someone who has used it before.

    Thanks, though.
    Chuck Johnson, May 1, 2013
    #11
  12. Lew Guest

    Chuck Johnson wrote:

    Again, please attribute citations. Did you not notice this request before?

    [Lew wrote:]
    >> I had no troubles with the linked project site. The Javadocs downloaded just fine. DId you
    >> try them?

    >
    > I am not really sure how to use javadocs to find what I'm looking for. I don't know what class or what


    Lots and lots of reading. Start with the summary of packages and work from there.

    > methods to look at. I'm pretty sure there a lots & lots of methods, so I would probably spend hours &
    > hours looking for the right method(s).


    You say that as if it were a reason not to do it. It isn't. That would be time very well spent.

    And the Rome Javadocs aren't all /that/ huge.

    > I was looking more for a wiki/tutorial, or someone who has
    > used it before.


    Too bad. Instead of rejecting the help you are getting in favor of the help you're not,
    get over it and accept the help you are getting.

    > Thanks, though.


    No need to get snarky. Just follow the advice.

    But since you don't like our advice, or our links, or respect requests for an SSCCE, try here:

    http://lmgtfy.com/?q=Java Rome RSS library

    There seem to be some useful links there.

    --
    Lew
    Lew, May 1, 2013
    #12
  13. Arne Vajhøj Guest

    On 4/30/2013 4:59 PM, Lew wrote:
    > Chuck Johnson wrote:
    >
    >> [attribution restored: please attribute citations]
    >> Lew wrote:
    >>> First of all, OP, don't ever do this:
    >>>
    >>> @SuppressWarnings("rawtypes") ...
    >>>
    >>> Second, give us this, please:
    >>>
    >>> http://sscce.org/
    >>>
    >>> As to docs for Rome, where have you looked so far?

    >>
    >> I suppressed warnings because I'm just trying to get Rome to work,

    >
    > A) Not relevant.
    > B) Not really going to do what you intend.
    > C) Don't use raw types.


    Why not tell him what you do when you are using a library
    that has a method that return a raw type!!!!

    Arne
    Arne Vajhøj, May 1, 2013
    #13
  14. Jeff Higgins Guest

    On 04/30/2013 09:33 PM, Arne Vajhøj wrote:
    > On 4/30/2013 4:59 PM, Lew wrote:
    >> Chuck Johnson wrote:
    >>
    >>> [attribution restored: please attribute citations]
    >>> Lew wrote:
    >>>> First of all, OP, don't ever do this:
    >>>>
    >>>> @SuppressWarnings("rawtypes") ...
    >>>>
    >>>> Second, give us this, please:
    >>>>
    >>>> http://sscce.org/
    >>>>
    >>>> As to docs for Rome, where have you looked so far?
    >>>
    >>> I suppressed warnings because I'm just trying to get Rome to work,

    >>
    >> A) Not relevant.
    >> B) Not really going to do what you intend.
    >> C) Don't use raw types.

    >
    > Why not tell him what you do when you are using a library
    > that has a method that return a raw type!!!!
    >

    Well, you have a point but:
    Chuck has demonstrated only a serious lack of gumption.

    > Here is what I tried: (everything works great, but getting enclosure
    > contents/values)

    And then copy pasted a few lines from some web site and added a single
    (misguided) line at the end, but hasn't shown that he understands any
    of it.

    I can't find the docs.
    I can't read the docs.
    I guess it returns a List, what now boss?
    It will take a lot of time.
    It will take a lot of effort
    I was looking more for a wiki/tutorial, or someone who has used it before.

    comp.lang.java.rentaprogrammer/tutor is <thataway>
    Jeff Higgins, May 1, 2013
    #14
  15. Jeff Higgins Guest

    On 05/01/2013 01:59 AM, lipska the kat wrote:
    > On 30/04/13 21:59, Lew wrote:
    >> Chuck Johnson wrote:

    >
    > [snip]
    >
    >> And I didn't ask for all your code, I asked for an SSCCE.

    >
    > How much smaller and more self contained do you imagine it could be?
    >

    Chuck hasn't provided any SSCCE, at lease not anything in the true spirit.
    Jeff Higgins, May 1, 2013
    #15
  16. On Wednesday, May 1, 2013 2:18:37 AM UTC-5, Jeff Higgins wrote:
    > On 05/01/2013 01:59 AM, lipska the kat wrote:
    >
    > > On 30/04/13 21:59, Lew wrote:

    >
    > >> Chuck Johnson wrote:

    >
    > >

    >
    > > [snip]

    >
    > >



    >
    > >> And I didn't ask for all your code, I asked for an SSCCE.

    >
    > >

    >
    > > How much smaller and more self contained do you imagine it could be?

    >
    > >

    >
    > Chuck hasn't provided any SSCCE, at lease not anything in the true spirit..


    1) I wasn't being snarky in the least. I was sincerely thankful.

    2) I'm a working student who is just working on a personal project for fun;I don't have lots of time. I did this same project in Python and it took me nowhere near the time it is taking me in Java. I guess it's my naive belief that a programmer should be able to reuse someone's code without spending as much time studying it as it would to just write my own.

    3) As for the SSCCE, I don't know what more I can give you. Like I said before in my first post, you have all the code I've wrote, save the import statements and class declaration, which I didn't include because I was trying to adhere to SSCCE.
    Chuck Johnson, May 1, 2013
    #16
  17. Jeff Higgins Guest

    On 05/01/2013 10:19 AM, Chuck Johnson wrote:
    > On Wednesday, May 1, 2013 2:18:37 AM UTC-5, Jeff Higgins wrote:
    >> On 05/01/2013 01:59 AM, lipska the kat wrote:
    >>
    >>> On 30/04/13 21:59, Lew wrote:

    >>
    >>>> Chuck Johnson wrote:

    >>
    >>>

    >>
    >>> [snip]

    >>
    >>>

    >
    >
    >>
    >>>> And I didn't ask for all your code, I asked for an SSCCE.

    >>
    >>>

    >>
    >>> How much smaller and more self contained do you imagine it could be?

    >>
    >>>

    >>
    >> Chuck hasn't provided any SSCCE, at lease not anything in the true spirit.

    >
    > 1) I wasn't being snarky in the least. I was sincerely thankful.


    I don't recall anyone accusing you of being snarky.

    > 2) I'm a working student who is just working on a personal project for fun; I don't have lots of time.

    I did this same project in Python and it took me nowhere near the time
    it is taking me in Java.

    Python is a great programming environment.
    Java is a great programming environment.

    I guess it's my naive belief that a programmer should be able to reuse
    someone's code
    without spending as much time studying it as it would to just write my own.

    ??

    > 3) As for the SSCCE, I don't know what more I can give you.

    Like I said before in my first post, you have all the code I've wrote,
    save the import statements and class declaration,
    which I didn't include because I was trying to adhere to SSCCE.
    >
    >

    Ill ask again. What does .getEnclosures() return?
    Have you found the Javadocs.
    Javadocs are the key to programming with Java libraries.
    What happens when you:
    System.out.println(new ArrayList<String>());

    In the code you provided you reference:
    SyndFeed
    SyndFeedInput
    SyndEntry
    What are these classes, what method do they expose?
    I don't need to know, you do.
    getEnclosures()
    presumably there is an Enclosure class.
    Does it provide a getScent() method?
    The Javadocs will answer.
    Study the Collections API. You can google it.
    Study Java Generics, and her relation to the Collections API. You can
    google it.
    Jeff Higgins, May 1, 2013
    #17
  18. Jeff Higgins Guest

    On 05/01/2013 10:19 AM, Chuck Johnson wrote:
    >
    > 2) I'm a working student who is just working on a personal project for fun; I don't have lots of time.


    Noone have as much as they would like. It's a juggling act.

    I did this same project in Python and it took me nowhere near the time
    it is taking me in Java.

    All depends on what you hope to accomplish.
    If you hope to learn a particular programming language and environment
    you'll need to spend the time and effort.
    If you're hoping to mash up a particular application, well, you know the
    rest.
    Jeff Higgins, May 1, 2013
    #18
  19. Jeff Higgins Guest

    On 05/01/2013 11:37 AM, Jeff Higgins wrote:

    > If you're hoping to mash up a particular application, well, you know the
    > rest.


    Just out of curiosity how much time in Perl, Elisp, Shell, C#, BF ...
    Jeff Higgins, May 1, 2013
    #19
  20. Jeff Higgins Guest

    Jeff Higgins, May 1, 2013
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Steeno

    add enclosure to e-mail message in html

    Patrick Steeno, Nov 12, 2003, in forum: Java
    Replies:
    4
    Views:
    968
    Roedy Green
    Nov 13, 2003
  2. Patrick Steeno

    add enclosure to e-mail message in html

    Patrick Steeno, Nov 12, 2003, in forum: Java
    Replies:
    1
    Views:
    456
    Roedy Green
    Nov 12, 2003
  3. J_Zanetti
    Replies:
    4
    Views:
    953
    Manish Pandit
    Jan 24, 2007
  4. Jonathan Groll
    Replies:
    1
    Views:
    251
    Kouhei Sutou
    Jun 27, 2009
  5. Replies:
    16
    Views:
    672
    Arne Vajhøj
    May 3, 2013
Loading...

Share This Page