Why does rss/maker not raise errors?

There are lots of mandatory attributes (yes, which are mandatory is
documented on the wiki), but what is mandatory is different for
different RSS versions, and there are no errors raised, #make just
returns 'nil'. This caused me some trouble.

I hacked an extra line into this:

  make/0.9.rb:22
    if rss.channel
      rss
    else
+ raise "required channel or image properties are missing!"
      nil
    end

This isn't a real solution - it doesn't say what property is missing,
and only is in the 0.9 code, somebody who knew the code could do this
much better!

Also, what is "image"? I don't know what to put there, so I just put
some strings, and my RSS reader ignores them.

After I figured out the mandatory, it worked very well, thank you!

Sam

--- example ---
#!/opt/local/bin/ruby -w

require 'rss/maker'

···

#
# Remove ANY one of the property setting lines, and #make will return nil
# (without my example patch).
#

rss = RSS::Maker.make("0.9") do |maker|
  maker.channel.title = "title"
  maker.channel.link = "link"
  maker.channel.description = "description"
  maker.channel.language = "language"

  maker.image.url = "maker.image.url"
  maker.image.title = "maker.image.title"

  item = maker.items.new_item
  item.title = "item title"
  item.link = "link"
end

puts rss.to_s

If you're producing RSS 0.9, I'd suggest looking here: PurplePages - The Irish Web Content Specialists

Looks like "image" is a non-mandatory tag. Personally I haven't seen many aggregators that use them -- also the Netscape spec requires that the image has to be 88 x 31 pixels, which seems mind-bogglingly arbitrary to me -- so I'd leave them out, I suppose.

The RSS space is a bloody awful mess. I'll be glad when everybody moves to Atom. (My own site included, but hey, I'm lazy.)

F.

···

On Nov 12, 2004, at 10:14 AM, Sam Roberts wrote:

Also, what is "image"? I don't know what to put there, so I just put
some strings, and my RSS reader ignores them.

It says it is optional here:

  http://backend.userland.com/rss091

Also, please refer to the DTD here:

  http://my.netscape.com/publish/formats/rss-0.91.dtd

Which says:

  <!ELEMENT channel (title | description | link | language | item+ | rating? | image? | ...

Unless I completely misread the DTD, <image> is as optional as <rating>.

Could this be corrected, please?

Thanks!
Sam

Hi,

In <20041112151406.GA5309@ensemble.local>
  "why does rss/maker not raise errors?" on Sat, 13 Nov 2004 00:14:19 +0900,

···

Sam Roberts <sroberts@uniserve.com> wrote:

                            there are no errors raised, #make just
returns 'nil'. This caused me some trouble.

OK.
I'll think about it.

--
kou

The RSS space is a bloody awful mess. I'll be glad when everybody moves
to Atom. (My own site included, but hey, I'm lazy.)

Go RSS 1.0 and don't look back!

Rich metadata! Arbitrary info in feeds! It's not just XML!

Ari

Hey Sam,

One good place to report & track bugs is the new Ruby project on Rubyforge:

http://rubyforge.org/projects/ruby

F.

···

On Nov 12, 2004, at 10:32 PM, Sam Roberts wrote:

It says it is optional here:

  RSS 0.91

Also, please refer to the DTD here:

  http://my.netscape.com/publish/formats/rss-0.91.dtd

Which says:

  <!ELEMENT channel (title | description | link | language | item+ | rating? | image? | ...

Unless I completely misread the DTD, <image> is as optional as <rating>.

Could this be corrected, please?

Thanks!
Sam

Sam Roberts wrote:

It says it is optional here:

  RSS 0.91

Also, please refer to the DTD here:

  http://my.netscape.com/publish/formats/rss-0.91.dtd

Are you sure that rss/0.9 is not dealing with RSS 0.9?

    http://my.netscape.com/publish/formats/rss-0.9.dtd

<!ELEMENT rdf:RDF (channel | image? | item+ | textinput?)*>

Same issue for the image element, though.

James

Francis Hwang wrote:

The RSS space is a bloody awful mess. I'll be glad when everybody moves to Atom. (My own site included, but hey, I'm lazy.)

The xml-dev list is having a nice discussion on Atom and RSS.

http://lists.xml.org/archives/xml-dev/200411/msg00240.html

James

···

F.

Hi,

In <20041113033204.GA453@ensemble.local>
  "bug: rss/maker is requiring <image> for rss/0.9" on Sat, 13 Nov 2004 12:32:13 +0900,

It says it is optional here:

  RSS 0.91

Really?

http://backend.userland.com/rss091#requiredLtchannelgtSubelements

Required <channel> sub-elements

Following are the required elements of a <channel>.

<title> -- ...

<link> -- ...

<description> -- ...

<language> -- ...

<image> -- ...

  ^^^^^^^

Also, please refer to the DTD here:

  http://my.netscape.com/publish/formats/rss-0.91.dtd

Is it available?

RSS 0.91 doesn't have *direct*
link to it. And its domain is my.netscape.com. (It's old,
isn't it???)

···

Sam Roberts <sroberts@uniserve.com> wrote:

--
kou

Quoteing kou@cozmixng.org, on Sun, Nov 14, 2004 at 03:11:38PM +0900:

> there are no errors raised, #make just returns 'nil'. This caused me some trouble.

OK.
I'll think about it.

Could you think about RSS::Parser.parse as well, because it is also
returning a mysterious nil.

I am parsing the RSS feed from 'http://dwlt.net/tapestry/getfuzzy.rdf&#39;
when it returns nil, and I have no idea why, do you?

Btw, at least some people think it is a valid feed:

  Feed Validator Results: http://dwlt.net/tapestry/getfuzzy.rdf

Thanks,
Sam

···

Sam Roberts <sroberts@uniserve.com> wrote:

----------
#!/opt/local/bin/ruby -w

require 'open-uri'
require 'rss/0.9'
require 'pp'

FEED = 'http://dwlt.net/tapestry/getfuzzy.rdf&#39;

feed = URI.parse(FEED).read

# pp feed

rss = RSS::Parser.parse(feed)

pp rss # --------> nil!

rss.items.each do |item|
  pp item
  pp item.link
  pp item.description
end

Well, as far as I know every single version of RSS has at least one glaring problem: It underspecifies what you're supposed to do if you want to send XML tags in your <description>. So you end up doing bloody awful things like actually _escaping_ your XML tags, and if you write a blog about, say, XML (there are a few, I think), and you're emitting escaped XML markers in your RSS code, you actually have to _double-escape_ them to get them to show up in most aggregators:

<item>
<description>
Remember, when you're switching to XHTML, the BR tag needs to be self-closing: &amp;lt;br /&amp;gt;
</description>
</item>

Aaaaaaaaargggggggggh.

And it doesn't really matter if any one version of RSS is decent, because the whole RSS world is a bloody mess. You can try, for convenience sake, to release a lib that's only compatible with RSS 1.0, but people will find that really super-annoying. And RSS will never move forward in any meaningful way, since there are actually _seven_ incompatible versions, put out by, I believe, three different organizations, and the de-facto owner of RSS wants it to stop more or less where it is.

Yesiree, I'm ready for Atom to hit big-time.

F.

···

On Nov 12, 2004, at 7:57 PM, Aredridel wrote:

The RSS space is a bloody awful mess. I'll be glad when everybody moves
to Atom. (My own site included, but hey, I'm lazy.)

Go RSS 1.0 and don't look back!

Rich metadata! Arbitrary info in feeds! It's not just XML!

Ari

Quoteing jamesUNDERBARb@neurogami.com, on Sat, Nov 13, 2004 at 03:13:22PM +0900:

Sam Roberts wrote:
>It says it is optional here:
>
> RSS 0.91
>
>Also, please refer to the DTD here:
>
> http://my.netscape.com/publish/formats/rss-0.91.dtd

Are you sure that rss/0.9 is not dealing with RSS 0.9?

You wish! You, as a rational person, are crediting the RSS world with
rationality!

rss/maker generates XML with:

  <?xml version="1.0" encoding="UTF-8"?>
  <rss version="0.91">
    <channel>
        <title>title</title>
  ...

The version matches the 0.91 DTD:

  version CDATA #REQUIRED> <!-- must be "0.91"> -->

Actually, I don't know how compliant you have to be, to be compliant,
but

  http://my.netscape.com/publish/formats/rss-spec-0.91.html

Says the DOCTYPE is mandatory:

  Files must be 100% valid XML. We're trying to move towards a more
  standard format, and to this end we have included several tags from
  the popular <scriptingNews> format. We have also ensured that this
  version is 100% valid XML. We did this by requiring that a DOCTYPE tag
  be included, and validating each RSS document against that DTD. This
  means that it is not enough for an RSS document to be "well-formed".
  It must also be "valid" with respect to its DTD.

Example:

  <?xml version="1.0"?>
  <!DOCTYPE rss SYSTEM "http://my.netscape.com/publish/formats/rss-0.91.dtd&quot;&gt;
  <rss version="0.91">
  <channel>
  ...

And rss/maker isn't including the DOCTYPE, so I guess its technically
non-compliant there, too. But, who cares?

I just care about image becaue a) its wrong, and b) it silently fails if
I don't have it, and c) I don't actually have a little GIF and a server
to put the little GIF on, so I'm just filling it with garbarge strings,
which RSS viewers are thankfully quietly ignoring when they find out its
garbage.

   http://my.netscape.com/publish/formats/rss-0.9.dtd

<!ELEMENT rdf:RDF (channel | image? | item+ | textinput?)*>

Same issue for the image element, though.

I don't know the history, but looking at 0.9's DTD, I'd say it looks
like 0.9 was an abortive attempt at using namespaces, and being
RDF-based. I think this died because it wasn't backwards compatible, and
was quickly rerleased as 0.91, and that nobody uses 0.9, they use 0.91,
and call it "0.9". Lovely.

Then "1.0' came out, based on RDF, totally incompatible, and everybody
started spitting on each other!

Atom, please, soon.

Cheers,
Sam

RSS standards are an endless debate I don't want to really be a big
part of.

For the rss/maker API I would like to give the feedback that it is not
useful for the RSS API to force me to generate a <image>. Luckily it
doesn't enforce content of the tag. I can put anything I want in, and
I'm putting garbage in because I don't have a server to publish an image
on. So, this API hasn't made the quality of the generated RSS any
better, if that was the goal.

Userland didn't publish RSS 0.91, and doesn't claim to:

  In July 1999, Netscape introduced RSS 0.91, incorporating most of the
  features of <scriptingNews> 2.0b1. At the same time My.UserLand.Com
  supported RSS 0.91.

They link to Netscape's specification from their page.

They did publish 2.0, or course, where <image> is optional:

  http://blogs.law.harvard.edu/tech/rss#requiredChannelElements

Incompatibilities between RSS standards isn't something you can fix, but
it seems to be making the matter worse to be choosing a fairly informal
description of "RSS 0.91" from Userland. They don't call it a
specification, they say:

  Therefore, this document is explains RSS as it's currently practiced.

Requireing <image> is going to make it hard to convert rss2.0 to 0.91,
too, since its optional in 2.0.

Quoteing kou@cozmixng.org, on Sun, Nov 14, 2004 at 03:02:17PM +0900:

> It says it is optional here:
> RSS 0.91

Really?

> Required <channel> sub-elements
>
> Following are the required elements of a <channel>.
> <image> -- ...

My apologies, I didn't notice that. Is this why you made it mandatory?

> Also, please refer to the DTD here:
> http://my.netscape.com/publish/formats/rss-0.91.dtd

Is it available?

I can resolve that URL.

RSS 0.91 doesn't have *direct*
link to it. And its domain is my.netscape.com. (It's old,
isn't it???)

RSS 0.91 has a direct link to:

  http://my.netscape.com/publish/formats/rss-spec-0.91.html

which documents image as optional.

That page links to the DTD, where it is also optional.

And yes, RSS 0.91 is old, but even if its old, isn't it still RSS 0.91?

Cheers,
Sam

Hi,

In <20050101215237.GA796@ensemble.local>
  "RSS::Parser.parse returning nil... (was Re: why does rss/maker not raise errors?)" on Sun, 2 Jan 2005 06:52:46 +0900,

···

Sam Roberts <sroberts@uniserve.com> wrote:

> > there are no errors raised, #make just returns 'nil'. This caused me some trouble.
>
> OK.
> I'll think about it.

Could you think about RSS::Parser.parse as well, because it is also
returning a mysterious nil.

I am parsing the RSS feed from 'http://dwlt.net/tapestry/getfuzzy.rdf&#39;
when it returns nil, and I have no idea why, do you?

Sorry, RSS Parser isn't supporting RSS 0.90.

Happy new year!
# But this is too late. :<
--
kou

Francis Hwang wrote:

Well, as far as I know every single version of RSS has at least one glaring problem: It underspecifies what you're supposed to do if you want to send XML tags in your <description>. So you end up doing bloody awful things like actually _escaping_ your XML tags, and if you write a blog about, say, XML (there are a few, I think), and you're emitting escaped XML markers in your RSS code, you actually have to _double-escape_ them to get them to show up in most aggregators:

Don't CDATA sections do it for you?

  <item>
  <description>
   <![CDATA[
    Remember, when you're switching to XHTML, the BR tag needs to be
    self-closing: <br />
   ]]>
  </description>
  </item>

James

Francis Hwang ha scritto:

Yesiree, I'm ready for Atom to hit big-time.

you mean ATOM::Parser and ATOM::Maker are ready for inclusion
  in ruby 1.8.3 ? :wink:

Hi,

In <20041114070003.GA4770@ensemble.local>
  "Re: bug: rss/maker is requiring <image> for rss/0.9" on Sun, 14 Nov 2004 16:00:13 +0900,

Incompatibilities between RSS standards isn't something you can fix, but
it seems to be making the matter worse to be choosing a fairly informal
description of "RSS 0.91" from Userland. They don't call it a
specification, they say:

  Therefore, this document is explains RSS as it's currently practiced.

I had missed this.
OK. I'll fix.

> > Required <channel> sub-elements
> >
> > Following are the required elements of a <channel>.
> > <image> -- ...

My apologies, I didn't notice that. Is this why you made it mandatory?

Yes.

···

Sam Roberts <sroberts@uniserve.com> wrote:

--
kou

when i was in the process of creating rss code for my blogging program
i wasn't surprised to find a few different versions of rss out there,
but i WAS surprised to find a few standards for each and no real
consensus on what to use...

i gave up on trying to use various rss modules so i just wrote brute
force code...that way if there's an error/consensus/bug, i can just
fix it directly...

it seems that most of the updated aggregators are more forgiving of
the various standards, but they never used to be...it's one of the
reasons i was jumping around with readers...
http://home.cogeco.ca/~tsummerfelt1
telnet://ventedspleen.dyndns.org

···

On Sun, 14 Nov 2004 16:00:13 +0900, you wrote:

RSS standards are an endless debate I don't want to really be a big
part of.

CDATA works, and it doesn't, more or less like escaping markup works, but doesn't. Keep in mind that these days my main site is all XHTML and I lean really hard on the basic conformance promise behind any XML dialect. So I think it's pretty inelegant to put conformant XML (XHTML) inside of conformant XML (RSS), but wrap it in an intermediate layer of CDATA, which says "this stuff isn't necessarily well-formed anything." I think it's a useful feature of XML that it will fall down and die without being well-formed, but when you put stuff inside of CDATA sections you don't get any of that benefit. (I'd go so far as to say that if you are working in a domain where these sorts of conformance concerns are not worth the hassle, you'd be better off using something like YAML instead of XML.)

F.

···

On Nov 12, 2004, at 8:39 PM, James Britt wrote:

Francis Hwang wrote:

Well, as far as I know every single version of RSS has at least one glaring problem: It underspecifies what you're supposed to do if you want to send XML tags in your <description>. So you end up doing bloody awful things like actually _escaping_ your XML tags, and if you write a blog about, say, XML (there are a few, I think), and you're emitting escaped XML markers in your RSS code, you actually have to _double-escape_ them to get them to show up in most aggregators:

Don't CDATA sections do it for you?

<item>
<description>
  <![CDATA[
   Remember, when you're switching to XHTML, the BR tag needs to be
   self-closing: <br />
  ]]>
</description>
</item>

Domo arigato gozaimasu!

Also, is anybody working on adding Atom support?

I'm about to read through some of your code to get ideas on implementing
a vCard Maker on top of my vCard library. It might be interesting to add
Atom support, but not if you or somebody is already planning it.

Thanks,
Sam

Quoteing kou@cozmixng.org, on Mon, Nov 15, 2004 at 12:12:51AM +0900:

···

In <20041114070003.GA4770@ensemble.local>
  "Re: bug: rss/maker is requiring <image> for rss/0.9" on Sun, 14 Nov 2004 16:00:13 +0900,
  Sam Roberts <sroberts@uniserve.com> wrote:

> Incompatibilities between RSS standards isn't something you can fix, but
> it seems to be making the matter worse to be choosing a fairly informal
> description of "RSS 0.91" from Userland. They don't call it a
> specification, they say:
>
> Therefore, this document is explains RSS as it's currently practiced.

I had missed this.
OK. I'll fix.

> > > Required <channel> sub-elements
> > >
> > > Following are the required elements of a <channel>.
> > > <image> -- ...
>
> My apologies, I didn't notice that. Is this why you made it mandatory?

Yes.

--
kou