April 06, 2006

Atom 1.0 parser for Ruby

I've been looking for a Ruby library for parsing Atom 1.0. The only one I could find was FeedTools. Unfortunately, it's intended to be a universal feed-parsing library and not quite what I need.

As a result, I decided to build my own. The project is hosted at RubyForge and the source code is available under the MIT license.

It is still in its early stages, so don't expect much at this point. So far, it understands most atom:* elements and attributes but doesn't perform validation.

The interface is fairly simple. For example, you can do this:

require 'atom'
require 'net/http'
require 'uri'

str = Net::HTTP::get(URI::parse('http://blog.ning.com/atom.xml'))
feed = Atom::Feed.new(str)

feed.entries.each { |entry|
puts "'#{entry.title}' by #{entry.authors.first.name} on #{entry.published.strftime('%m/%d/%Y')}"

Give it a try, play with it. Comments are welcome!



Blogger mcdtracy said...

Pretty easy to get started...

to install I downloaded the "gem" file and installed with:

$ gem install atom

run in the directory of the download.

I printed out the contents too with this code:

require 'atom'
require 'net/http'
require 'uri'

str = Net::HTTP::get(URI::parse('http://blog.ning.com/atom.xml'))
feed = Atom::Feed.new(str)

feed.entries.each { |entry|
puts "-----------------------------------------------------------------------------------------"
puts "'#{entry.title}' by #{entry.authors.first.name} on #{entry.published.strftime('%m/%d/%Y')}
puts "-----------------------------------------------------------------------------------------"
puts "'#{entry.summary}'"
puts "-----------------------------------------------------------------------------------------"
puts "'#{entry.content.value}'"
# or print the entire entry contents with the next line uncommented:
# p entry

April 12, 2006 6:19 PM  
Blogger 道喜技术日记 said...

How to get Link href value?

February 04, 2007 3:29 PM  
Blogger 道喜技术日记 said...


February 04, 2007 3:47 PM  
Blogger Tim Morgan said...

This is exactly what I was looking for! This, combined with the standard Ruby RSS parser, should give me everything I need to grab feeds I think. You rock!

August 07, 2007 8:09 AM  
Blogger malikiqbal said...

is it possible to generate Google apps atom feed?

If yes then what kind changes i nned to do with this library or need to embed any other library with this.

December 12, 2007 10:42 PM  
Blogger malikiqbal said...

This comment has been removed by the author.

December 12, 2007 10:43 PM  
Blogger tbeauvais said...

Hi, is there a way to get at extension elements in the Atom feed? For example <openSearch:totalResults>

July 11, 2008 1:00 PM  
Blogger Ashish said...

How do I get the value of src from the following?
content type="text/plain"
I tried entry.content.src, entry.content['src']. But both didn't work

November 03, 2008 5:54 AM  
Blogger Martin said...

entry.content.src should work. Can you send me your complete test case so that I can debug it here?

November 03, 2008 8:17 AM  
Blogger Ashish said...

Hi Martin,
I did 'inspect' on the feed returned by Atom. The value of src goes as the value of href of the third link in the entry. Not sure why that happens but am able to access src using entry.links[2].href

November 03, 2008 10:25 PM  
Anonymous Anonymous said...

welcome to the wow power leveling cheap service site, buy wow power leveling cheap wow gold,wow gold,world of warcraft wow power leveling buy wow gold

February 06, 2009 11:45 PM  
Anonymous Anonymous said...

Gold key link for( wow power leveling )the law by( wow power leveling )all, such as bubble( power leveling )shadow dream hallucinations, such( wow gold )as exposed as well( wow powerleveling )as electricity, should be the case

April 02, 2009 12:10 AM  
Anonymous Anonymous said...

You know ,I have some priston tale Gold,and my friend also has some priston tale Money,do you kouw they have the same meaning,I just want to buy priston tale Gold,because there are many cheap priston tale GoldYou know ,I have some wonderland Gold,and my friend also has some wonderland online Gold,do you kouw they have the same meaning,Both of them can be called
wonderland money,I just want to
buy wonderland Gold,because there are many
cheap wonderland online Gold

April 14, 2009 5:58 PM  
Anonymous Anonymous said...

Why was there no follow on bankruptcy then? The bailout of AIG FP went to (wow power leveling) hedge funds that bound credit swaps on Lehman failing or others betting on rating (wow power leveling) declines. AIG has drained over 100 billion from the government. Which had to go to (wow power leveling) those who bet on failures and downgrades. Many of whom (power leveling)were hedge funds. I-banks that had offsetting swaps needed the money from the AIG bailout or they would have been caught. Its an (wow powerleveling) insiders game and it takes just a little bit too much time for most people to think (wow gold) through where the AIG 100 billion bailout money went to, hedge funds and players, many of whom hire from the top ranks of DOJ, Fed, Treasury, etc. ZHANG XIAO CHEN

April 19, 2009 10:00 PM  
Anonymous Anonymous said...

I can get Perfect World Gold cheaply,
Yesterday i givePerfect World moneyfor my brother.
i hope him like it. iBuy Perfect World Gold to him as birthday present.
i like the Perfect World Silver very much.
I usually buycheap Perfect World Gold and keep it in my store.
I enjoy the pw gold.

May 04, 2009 5:27 PM  
Anonymous Anonymous said...

I can get Pirates of the Burning Sea Gold cheaply,
Yesterday i want to buy potbs goldfor my brother.
i hope him like it. i will buy potbs Doubloon for him
as birthday present. i like the potbs money very much.
I usuallybuy potbs Doubloon and keep it in my store.

May 04, 2009 5:27 PM  
Anonymous Anonymous said...

As a new player , you may need some game guides or information to enhance yourself.
FFXI Gil is one of the hardest theme for every class at the beginning . You must have a good way to manage your FFXI gold.If yor are a lucky guy ,you can earn so many Final Fantasy XI gold by yourself . But if you are a not , I just find a nice way to buy FFXI Gil. If you need , you can buy cheap Final Fantasy XI Gold at our website . Go to the related page and check the detailed information . Once you have any question , you can connect our customer service at any time .

Making aoc gold is the old question : Honestly there is no fast way to make lots of conan gold . Sadly enough a lot of the people that all of a sudden come to with millions of age of conan gold almost overnight probably duped . Although there are a lot of ways to make lots of cheap aoc gold here I will tell you all of the ways that I know and what I do to buy aoc money.

May 04, 2009 5:33 PM  
Anonymous Anonymous said...

Tibia Gold and the game I have played for about 3 years. You should compensate him by giving him some Tibia coins; you have to lure a handful of monsters with Tibia money so that switching between them can be easier. There are many benefits to guild in tibia gp. When you join in Tibia Platinum, it is not still deal high amounts of damage.

May 04, 2009 8:05 PM  
Anonymous Anonymous said...

silkroad gold in the silkroad you may or may not notice, without need of huge buffing. I know vitality is very tempting in sro gold, you get after level 100 every time you level. You may be feeling intelligence in silk road gold. You are going to be getting crab pincers which like silkroad online gold, depending on which server you are on. cheap silkroad gold can help you get a high level in short time.

May 04, 2009 8:08 PM  
Anonymous Anonymous said...

One very common item bought with cheap SOF gold at the store would be a pet. The Gameim.com is offering you with Scions Of Fate money and all kinds of cheap game gold. Scions Of Fate gold is sometimes need to pay for in this Scions of Fate game. For example in this game, we have to buy sof gold to exchange premium in order to protect our character. The only part of this game will require you to pay SOF gold but they are optional for you to choose in the premium store.

May 04, 2009 10:45 PM  
Anonymous Anonymous said...

Do you know the tcos Gold, in the game you need the chronicles of spellborn gold. it can help you increase your level. My friends always asked me how to buy
the chronicles of spellborn Gold, and I do not know he spend how much money to buy
tcos money, when I see him in order to play the game and search which the place can buy the
chronicles of spellborn money. I am happy with him.
Do you know the fiesta Gold, in the game you need the
fiesta money. it can help you increase your level. My friends always asked me how to
buy fiesta Gold, and I do not know he spend how much money to buy the
fiesta online gold, when I see him in order to play the game and search which the place can buy the
fiesta online money. I am happy with him.

May 04, 2009 11:47 PM  
Anonymous Anonymous said...

Once I played 4story, I did not know how to get strong, someone told me that you must have 4story Luna. He gave me some 4story Gold, he said that I could buy 4story Luna, but I did not have money, then I played it all my spare time. From then on, I got some 4story money, if I did not continue to play it, I can sell cheap 4story Luna to anyone who want.

May 05, 2009 12:01 AM  
Anonymous Anonymous said...

BJB is wholesale jewelryexporter from China,and specialize in wholesale handmade jewelry,including wholesale pearl,wholesale crystal,wholesale gemstone,wholesale turquoise,wholesale coral,wholesale shell, wholesale swarovski,wholesale beads and etc.

May 06, 2009 6:59 PM  
Blogger wow.com said...

wow power levelingpower levelingwow power levelpowerlevelingpower levelwow powerlevelingwow goldbuy wow goldcheap wow gold

May 15, 2009 6:23 AM  
Anonymous Anonymous said...

cheap wow gold buy wow power leveling cheap cheap wow gold

September 02, 2009 11:46 PM  
Anonymous Anonymous said...

wow gold
wow power leveling
cheap wow gold
wow powerleveling
buy wow gold
wow power level
world of warcraft gold
wow powerlevel
gold wow
World of Warcraft powerleveling
wow gold
World of Warcraft power leveling
power leveling wow
wow gold cheap
power leveling
wow gold buy
power leveling wow
powerleveling wow
world of warcraft Powerleveling
world of warcraft Power leveling
cheap wow power leveling
cheap wow powerleveling

September 03, 2009 1:16 AM  
Blogger kopter said...

Thank you so much!!cheap polo shirts men'ssweate,Burberry Polo Shirts lacoste sweater, ralph lauren Columbia Jackets,ski clothing. Free Shipping, PayPal Payment. Enjoy your shopping experience on mensclothingus.com.You can find the father who desire fashionable, intellectual mens clothing simultaneouslyGod bless you!I really agree with your opinions.Also,there are some new fashion things here,gillette razor blades.gillette mach3 razor bladesfor men.As for ladies,gillette venus razor blades must the best gift for you in summer,gillette fusion blades are all the best choice for you.Fantastic!God bless you!Meanwhile,you can visit my ,we have the highest quality but the lowest price fashion products wholesale from China.Here are the most popular China Wholesale products for all of you.You can visit .Also the is a great choice for you.

September 03, 2009 3:50 AM  
Anonymous Anonymous said...

Cell phones from simple communication became a full-featured entertainment terminal . Can be said that cell phone china new milestone in the industry. This fully demonstrates that, cheap cell phones entertainment has become the most sought after consumer applications and has become the focus of the mobil phones market.

September 24, 2009 8:51 PM  
Anonymous Anonymous said...

www.crazypurchase.com Web site for the majority of the china wholesalers, and buy products wholesale to provide information and buy wholesale from china information exchange platform dedicated to becoming China Wholesale.

September 24, 2009 8:51 PM  
Blogger Adi said...

Pandeglang is one of many places in Indonesia are eligible for tourist destination.
Kenali dan Kunjungi Objek Wisata di Pandeglang Objek Wisata di Pandeglang Kenali dan Kunjungi Objek Wisata di Pandeglang Pantai Carita Seni Saman Rampak Bedug

October 29, 2009 11:05 PM  
Anonymous Anonymous said...

Nice work and thanks!
Adidas currently manufactures several running shoesNike shoes, including the adiStar Control 5, the adiStar Ride
Cheap nike shoes
Discount nike shoes
the Supernova Sequence and the Supernova Cushion 7, among others.
Nike shox r4
nike shox torch
nike shox shoes
Adidas also uses kangaroo leather to make their more expensive shoes.
Association football
One of the main focuses of Adidas is football kit and associated equipment.
puma cat
cheap sport shoes
Adidas also provides apparel and equipment for all teams in Major League Soccer. Adidas remain a major company in the supply of team kits for international football teams.
cheap nike shox
cheap nike max
Adidas also makes referee kits that are used in international competition and by many countries and leagues in the world. In the United States, referees wear the Adidas kits in MLS matches even though the primary referee supplier is Official Sports.
nike tn dollar
nike running shoes
The company has been an innovator in the area of footwear for the sport with notable examples including development of the Copa Mondial moulded boot on firm dry pitches for forty years.
nike air max tn
puma shoes
Adidas became renowned for advancing the "Predator" boot design.This design featured a ribbed rubber structure for the upper leather of the shoe, used to accent the movement of the ball.
discount puma shoes
puma mens shoes
The Predator also features the Craig Johnston invented "Traxion" sole. As the development and popularity of Football continued Adidas played a leading role in shaping the style of the play itself.
puma running shoes
puma shoes
FIFA, the sports governing body, commissioned specially designed footballs for use in its own World Cup tournaments to favour more attacking play.
ghd hair straighteners mk4
hair straightners
ghd iv styler hair straightener
ghd hair straightners
cheap ghd hair straighteners

December 15, 2009 4:51 PM  
Anonymous Anonymous said...

Clothing has always been a thing that has been given a great importance by human beings. It displays the attitude that the people exhibit.
ed hardy clothes
ed hardy shirts
Lots of brands have been existent in the clothing industry and a famous one among them is the Ed hardy clothing brand.
ed hardy jackets
ed hardy hoodies
The brand got its name from the famous American tattoo artist Ed Hardy. He was a very famous tattoo artist and has published many books on tattooing techniques.
ed hardy boots
ed hardy polo shirts
But his tattooing turned into a brand by the efforts of a company called Christian Audiger. This company was a very famous and very powerful company in the field of clothing.
ed hardy shoes
ed hardy jeans
They felt that it would be appropriate to create a brand called Ed hardy and use Hardy's art as the main selling point for the brand. This venture had turned out to be a very successful one and Ed hardy clothing is one of the most famous brands in the clothing industry.
ed hardy outerwear
ed hardy long sleeve shirts
The brand became very famous because it was worn by many famous celebrities like Madonna, Britney spears and also Sylvester Stallone.
ed hardy bags
ed hardy uggr boots
The brand has clothes for men, women, and kids. They have also diversified their business by having a lot of accessories to support their clothing business.
ed hardy love kills slowly shirts
ed hardy love kills slowly shoes
ed hardy love kills slowly boots
for men they have a variety of products such as active wear, denim, outwear, swim trucks, sweaters, t-shirts, tops etc.
ed hardy trousers
ed hardy mens
the accessories include things such as belts, caps, scarves, shoes, socks, jeweler, sunglasses, ties and even wallets.
The art works is a unique combination of American and Japanese cultures. The unique selling proposition of the brand is the way in which the company has used the art works of Ed hardy.
ed hardy womens
ed hardy t shirts
ed hardy sunglasses

December 15, 2009 4:51 PM  
Anonymous Anonymous said...

Your blog is wonderful, I like it very much, thank you!
By the way, do you like polo shirts, which are very chic, especially the polo t shirts, I love them very much. I also like playing tennis rackets, it can keep healthy, what do you like to do?
We are the outlet of polo t shirts women, polo t shirts on sale, polo t shirts for women, polo shirts on sale, these products are best-seller in our store online.besides we also sell polo shirts men, men's polo shirt, men polo shirt, mens polo shirts, mens polo shirt and cheap polo shirts, discount polo shirts, men's polo shirts, women's polo shirts We are also the outlet of cheap tennis racket, discount tennis racket and the main product is prince tennis racquet, head tennis rackets, wilson tennis racket, babolat tennis racquet. So if you love sports, you should not miss our store, we can meet what you want, and you can find many surprise in our store

December 23, 2009 12:19 AM  

Post a Comment

<< Home