why does rss/maker not raise errors?

S

Sam Roberts

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
 
F

Francis Hwang

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

If you're producing RSS 0.9, I'd suggest looking here:
http://www.purplepages.ie/RSS/netscape/rss0.90.html

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.
 
A

Aredridel

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
 
F

Francis Hwang

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.
 
J

James Britt

Francis said:
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
 
F

Francis Hwang

Francis said:
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>

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.
 
A

Aredridel

RSS 1.0 defines that. rdf:parseType='xmlliteral', or enclose in CDATA
or escaped entities. The first is preferred if the content is XML as
well.
 
F

Francis Hwang

Aredridel,

I was poking around in the RSS 1.0 spec and didn't see anything about
rdf:parseType. Is that just something standard with all RDF docs? (I
don't use RDF much myself.)

F.
 
S

Sam Roberts

Quoteing (e-mail address removed), on Sat, Nov 13, 2004 at 03:13:22PM +0900:
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">
<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
 
A

Aredridel

Aredridel,

I was poking around in the RSS 1.0 spec and didn't see anything about
rdf:parseType. Is that just something standard with all RDF docs? (I
don't use RDF much myself.)

Yup. It's a standard RDF thing (as evidenced by the namespace).
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"bug: rss/maker is requiring <image> for rss/0.9" on Sat, 13 Nov 2004 12:32:13 +0900,
Sam Roberts said:

Really?

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

| Required <channel> sub-elements
|
| Following are the required elements of a <channel>.
|
| <title> -- ...
|
| <link> -- ...
|
| <description> -- ...
|
| <language> -- ...
|

Is it available?

http://backend.userland.com/rss091 doesn't have *direct*
link to it. And its domain is my.netscape.com. (It's old,
isn't it???)
 
S

Sam Roberts

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 (e-mail address removed), on Sun, Nov 14, 2004 at 03:02:17PM +0900:
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?
Is it available?

I can resolve that URL.
http://backend.userland.com/rss091 doesn't have *direct*
link to it. And its domain is my.netscape.com. (It's old,
isn't it???)

http://backend.userland.com/rss091 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
 
F

Francis Hwang

Does RDF, and hence RSS 1.0, specify what to do with tags that look
like they might markup HTML?

<description><![CDATA[
This is a picture of my cat: <img src="http://fhwang.net/img/kitty.gif"
/>
]]></description>

<description><![CDATA[
<gripe>I hate RSS</gripe>
]]></description>

<description><![CDATA[
This is my picture of a spaceship: <=O=>
]]></description>
 
K

Kouhei Sutou

Hi,

In <[email protected]>
"Re: bug: rss/maker is requiring <image> for rss/0.9" on Sun, 14 Nov 2004 16:00:13 +0900,
Sam Roberts said:
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.

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

Yes.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top