require 'java'

Abdera = org.apache.abdera.Abdera
URL    = java.net.URL

if ARGV.length != 1 then
  STDERR.print <<EOF
Usage: parse.rb <url>
EOF
  exit 1
end

url = URL.new(ARGV[0])

abdera = Abdera.new

parser = abdera.parser

doc = parser.parse(url.open_stream(), url.to_string())

feed = doc.root

print "#{feed.title}\n"

for entry in feed.entries do
  print "  #{entry.title} posted on #{entry.updated}\n"
end
