RSS::Parser Documentation

Hi

I am trying to use the RSS classes from “rss/2.0” and everything works
but I want to know what attributes and properties I can get at from each
of the classes I am getting back.

For example, the class has a “channel” which I can tell has a “title”
attribute (because it works when I query it :slight_smile: but I would really like a
list of every attribute that is supported!

I found documentation for it here:
http://www.ruby-doc.org/stdlib/libdoc/rss/rdoc/

But unless I am missing it, taking the example I used before and looking
at the doc for RSS::Rss::Channel:
http://www.ruby-doc.org/stdlib/libdoc/rss/rdoc/classes/RSS/Rss/Channel.html

It doesnt tell me the basics like what attributes and methods it has. Am
I missing something? What is the best way at getting at this information
or am I going to have to plough through the source?

Dave

I haven’t used the RSS/2.0 lib, I am using the FeedTools plugin and so
far it
works perfectly for the feeds I have tested.

The problem you are asking is a generic one, like how can I discover
what
methods are available for an object. You can ask the object itself,
“object.methods” will list all methods. Coming from the Java world
sometimes
I miss the “.” :wink: But Ruby brought the fun back :slight_smile:

Generally I play with the “ruby console” to play with the objects and it
helps quickly to discover what’s there and how to use it.

_Hari

View this message in context:
http://www.nabble.com/RSS%3A%3AParser-Documentation-tf1872507.html#a5118388
Sent from the RubyOnRails Users forum at Nabble.com.

Thanks for the response Nari, I have tried that but taking my example
above… is this really the best documentation I can get for these
inbuilt classes:

=> ["==", “===”, “=~”, “id”, “send”, “`”, “b64encode”, “blank?”,
“categories”, “category”, “category=”, “class”, “clone”, “cloud”,
“cloud=”, “convert”, “converter=”, “copy_instance_variables_from”,
“copyright”, “copyright=”, “daemonize”, “date”, “date=”, “dclone”,
“decode64”, “decode_b”, “description”, “description=”, “display”,
“do_validate”, “do_validate=”, “docs”, “docs=”, “dup”,
“enable_warnings”, “encode64”, “eql?”, “equal?”, “extend”,
“extend_with_included_modules_from”, “extended_by”, “freeze”, “frozen?”,
“full_name”, “generator”, “generator=”, “hash”, “id”, “image”, “image=”,
“indent_size”, “inspect”, “instance_eval”, “instance_exec”,
“instance_of?”, “instance_values”, “instance_variable_get”,
“instance_variable_set”, “instance_variables”, “is_a?”, “item”, “item=”,
“items”, “kind_of?”, “language”, “language=”, “lastBuildDate”,
“lastBuildDate=”, “link”, “link=”, “load”, “managingEditor”,
“managingEditor=”, “method”, “methods”, “nil?”, “object_id”,
“other_element”, “private_methods”, “protected_methods”, “pubDate”,
“pubDate=”, “public_methods”, “rating”, “rating=”,
“remove_subclasses_of”, “require”, “require_gem”,
“require_gem_with_options”, “require_library_or_gem”, “respond_to?”,
“returning”, “send”, “set_category”, “set_item”, “setup_maker”,
“silence_stderr”, “silence_stream”, “silence_warnings”,
“singleton_methods”, “skipDays”, “skipDays=”, “skipHours”, “skipHours=”,
“subclasses_of”, “suppress”, “tag_name”, “taguri”, “taguri=”, “taint”,
“tainted?”, “textInput”, “textInput=”, “title”, “title=”, “to_a”,
“to_json”, “to_s”, “to_yaml”, “to_yaml_properties”, “to_yaml_style”,
“ttl”, “ttl=”, “type”, “untaint”, “validate”, “validate_for_stream”,
“webMaster”, “webMaster=”, “with_options”]

Ok that does technically give me the name of all methods I can call but
it contains no description of them whatsoever and sure, I can figure out
that title is the title of the feed but (and this is just an example)
what is skipHours ?, ok so I could call it to try and get more
information but all it tells me is “nil”.

This cant be the best documentation available for these classes, can it?

I also found this now:
http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3ATutorial.en

Which is fantastic, but as you say this is a generic problem and while
that will solve my current issue I know that there isnt a document of
this standard available for most of these classes.

Dave, unless you’re not planning on supporting Atom feeds or RSS 1.0
feeds (very likely a mistake unless you’re only looking to parse one
or two feeds which you happen to be the publisher of) the ‘rss/2.0’
code isn’t likely to be a good choice. If the feeds you’re parsing
happen to become invalid (happens all the time) your site may break if
you’re using ‘rss/2.0’ to parse. SimpleRSS or FeedTools are both
better ways to go, IMHO, depending on whether you need speed or
accuracy, respectively.

(Disclaimer: Obviously, I wrote FeedTools, so I’m biased.)

Cheers,
Bob A.

AIM: sporkmonger
Jabber: [email protected]

I also found this now:
http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3ATutorial.en

Which is fantastic, but as you say this is a generic problem and while
that will solve my current issue I know that there isnt a document of
this standard available for most of these classes.

Hi Bob

Since writing this post, you will be pleased to know I have switched to
FeedTools :slight_smile: I have even taken on board FeedUpdater and I have just
finished integrating that with my existing code. I might IM you or
something soon because I have a requirement of the updater which if you
also like the idea, I might try and submit as a patch to you.

Dave

Hehe, alright. Go for it, patches are always welcome.

Cheers,
Bob A.

AIM: sporkmonger
Jabber: [email protected]

Bob A. wrote:

Dave, unless you’re not planning on supporting Atom feeds or RSS 1.0
feeds (very likely a mistake unless you’re only looking to parse one
or two feeds which you happen to be the publisher of) the ‘rss/2.0’
code isn’t likely to be a good choice. If the feeds you’re parsing
happen to become invalid (happens all the time) your site may break if
you’re using ‘rss/2.0’ to parse. SimpleRSS or FeedTools are both
better ways to go, IMHO, depending on whether you need speed or
accuracy, respectively.

Hi Bob

Since writing this post, you will be pleased to know I have switched to
FeedTools :slight_smile: I have even taken on board FeedUpdater and I have just
finished integrating that with my existing code. I might IM you or
something soon because I have a requirement of the updater which if you
also like the idea, I might try and submit as a patch to you.

Dave