0.0
No commit activity in last 3 years
No release in over 3 years
Rudimentary OPML parsing classes for Feedjira
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 5.5
~> 10.0

Runtime

~> 2.0
 Project Readme

Feedjira::Opml

Gem Version Dependency Status Build Status Code Climate Coverage Status

This gem registers a new parser with Feedjira which provides basic support for OPML files. It is based on OPML version 2.0, but does not currently support all aspects of the specification (directories, for example, are not supported).

Beyond what is provided by Feedjira, there is no support for converting OPML files to hashes, or generating valid OPML from other data sources.

Usage

Since feedjira-opml automatically registers its OPML parser with Feedjira, using the standard processing methods should generally yield the desired results.

Feedjira::Feed.parse(string_of_xml)

The OPML parser will match on /\<opml/, so it won't conflict with RSS, Atom, or other native Feedjira parsers.

If its necessary to use the OPML parser explicitly:

Feedjira::Feed.parse_with(Feedjira::Parser::OPML, string_of_xml)

Output

All elements and attributes are typecast based on the OPML specification. The behavior for handling values that don't adhere to the spec is undefined.

@opml.head.title
@opml.head.owner_name
@opml.head.date_created # Returns a Time
@opml.head.expansion_state # Returns an Array

Working with outlines is similar.

outline = @opml.body.outlines.first

url = outline.xml_url # Returns a URI

The isComment and isBreakpoint attributes are converted to booleans and accessed through convenience methods.

is_comment = outline.comment?

There are certain situations where the spec requires certain values meet some criteria based on other values, (e.g. "An outline element whose type is link must have a url attribute whose value is an http address."). These requirements are not currently enforced by the parser.