8

I created an RSS feed with Java Rome lib. The project is near the end. But I found strange behavior in some RSS clients.

I think it's more of an RSS clients' problem, but I want to make sure.

Rome holds items in a List, so the latest items are at the end of the list. I opened my feed in my RSS clients (Firefox and RSS Bandit) and I found they are in reversed order (technically it's chronological, but reversed compared to the order I used).

I thought it's an RSS client bug (I usually use Google Reader), but I checked some feeds on the Internet and saw that reason that they display correctly is they have reverse ordered items (oldest on the top).

But XML parsers shouldn't rely on item order. Why do RSS clients use item order instead of dates for sorting items?

And, most importantly, should I reorder my items list?

Edit: I found an easy solution:

     entries.add(0,entry); // :-)

But the question about "correct" client behavior remains.

Nateowami
  • 1,005
  • 16
  • 23
Maciek Sawicki
  • 6,717
  • 9
  • 34
  • 48
  • General XML parsers should definitely rely on node order. See for example the DOM's `firstChild`. – Johannes Hoff Dec 02 '09 at 09:31
  • Right. I was wrong when it comes to XML parsers. So there was no question. Only comment that Rome's design in this aspect is poor. They have the same bug in tutorial. – Maciek Sawicki Dec 02 '09 at 09:46

2 Answers2

10

One of the underlying problems of RSS is that there really isn't a single standard whose field usage is well-defined. I would worry much more about what clients and servers actually seem to do, not what you think a spec theoretically tells them to do...

Neil Coffey
  • 21,615
  • 7
  • 62
  • 83
0

I have a question: doesn't its a client issue, and are you publishing the date properly for each item. Ideally the clients should sort using the Pub Date and each item should have a GUID for the clients to identify it properly.

Priyank Bolia
  • 14,077
  • 14
  • 61
  • 82
  • I checked few feeds on the Internet all are revers sorted. I think clients ignore dates. this is my node: Utworzono nową grupę 2009-12-02T09:29:59Z 2009-12-02T09:29:59Z Obserwuję teraz grupę: a 2009-12-02T09:29:59Z I think date is in correct format (I think Rome lib works correct). Revers sorting items solved problem. – Maciek Sawicki Dec 02 '09 at 09:32
  • I disagree, the stackoverflow is not reverse sorted, nor do many sites: http://stackoverflow.com/feeds/question/1830580 – Priyank Bolia Dec 02 '09 at 09:45
  • to me reverse sorting looks like a workaround, not a solution – Priyank Bolia Dec 02 '09 at 09:46
  • ok I checked it again. I think This is really very little difference. Notifications fill be work in both cases (i think this is done withe simple diff). Only difference is order in Firefox feed preview (but nobody use it anyway). – Maciek Sawicki Dec 02 '09 at 09:58