[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to parse in RSS

Ruby Girl

9/5/2008 11:54:00 PM

Hi Experts,

Is there another way to get a valid date from pubDate in RSS like this
example:
<pubDate>Wed, 23 Feb 2005 16:12:56 GMT</pubDate>
...to a format (YYYYMMDD hh:mm:ss) that is recognizable by the parsers?

Ruby Girl
--
Posted via http://www.ruby-....

2 Answers

Axel Etzold

9/6/2008 12:22:00 AM

0


-------- Original-Nachricht --------
> Datum: Sat, 6 Sep 2008 08:53:52 +0900
> Von: Ruby Girl <rubyongirl@gmail.com>
> An: ruby-talk@ruby-lang.org
> Betreff: How to parse <pubDate> in RSS

> Hi Experts,
>
> Is there another way to get a valid date from pubDate in RSS like this
> example:
> <pubDate>Wed, 23 Feb 2005 16:12:56 GMT</pubDate>
> ...to a format (YYYYMMDD hh:mm:ss) that is recognizable by the parsers?
>
> Ruby Girl
> --
> Posted via http://www.ruby-....

Hi Ruby Girl,

if you remove the <pubdate> and the weekday, parsing works:

require "date"
text="<pubDate>Wed, 23 Feb 2005 16:12:56 GMT</pubDate>"
text.gsub!(/<\/*pubDate>/,'')
text.gsub!(/^...,/,'')
p text #text="23 Feb 2005 16:12:56 GMT"
p DateTime.parse(text)

Best regards,

Axel
--
GMX Kostenlose Spiele: Einfach online spielen und Spaß haben mit Pastry Passion!
http://games.entertainment.gmx.net/de/entertainment/games/free/puzz...

Peña, Botp

9/6/2008 4:17:00 AM

0

RnJvbTogUnVieSBHaXJsIFttYWlsdG86cnVieW9uZ2lybEBnbWFpbC5jb21dIA0KIyBJcyB0aGVy
ZSBhbm90aGVyIHdheSB0byBnZXQgYSB2YWxpZCBkYXRlIGZyb20gcHViRGF0ZSBpbiBSU1MgbGlr
ZSB0aGlzDQojIGV4YW1wbGU6DQojICA8cHViRGF0ZT5XZWQsIDIzIEZlYiAyMDA1IDE2OjEyOjU2
IEdNVDwvcHViRGF0ZT4NCiMgLi4udG8gYSBmb3JtYXQgKFlZWVlNTUREIGhoOm1tOnNzKSB0aGF0
IGlzIHJlY29nbml6YWJsZSBieSANCiMgdGhlIHBhcnNlcnM/DQoNCmlmIHlvdSBkb3dubG9hZGVk
IHRoYXQgdXNpbmcgcnVieSByc3MsIHRoYXQgd291bGQgYXV0b21hdGljYWxseSBiZSBwYXJzZWQu
IHBscyBwb3N0IHlvdXIgcnNzIGNvZGUuDQoNCmtpbmQgcmVnYXJkcyAtYm90cA0K