How to parse OPML with Ruby

Ruby posted over 3 years ago by christian

This example demonstrates how to parse OPML with Ruby.

First install the gem.

   1  gem install opml

Then run this code:

   1  require 'pp'
   2  require 'rubygems'
   3  require 'opml'
   4  
   5  opml = Opml.new(File.read('opml.xml'))
   6  pp opml
   7  
   8  opml.outlines[0].attributes['xml_url']
   9  opml.outlines[0].attributes['html_url']
  10  opml.outlines[0].attributes['title']

Tagged opml, xml, parse, ruby