# OPML
[](https://hex.pm/packages/opml)
[](https://hexdocs.pm/opml)
An Elixir library for parsing OPML (Outline Processor Markup Language) content from URLs or direct XML content. Outputs programmer-friendly, parsed JSON data structures.
## Installation
The package can be installed, via [Hex](https://hex.pm/packages/opml), by adding `opml` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:opml, "~> 0.1.0"}
]
end
```
## Usage
### Parsing with URL
Parsing is as straightforward as invoking the following command:
```elixir
> Opml.parse("http://hosting.opml.org/dave/spec/subscriptionList.opml")
```
And it will be return
```elixir
{:ok, %{
"body" => %{
"outlines" => [
%{
"description" => "Technology, and the way we do business, is changing the world we know. Wired News is a technology - and business-oriented news service feeding an intelligent, discerning audience. What role does technology play in the day-to-day living of your life? Wired News tells you. How has evolving technology changed the face of the international business world? Wired News puts you in the picture.",
"htmlUrl" => "http://www.wired.com/",
"language" => "unknown",
"text" => "Wired News",
"title" => "Wired News",
"type" => "rss",
"version" => "RSS",
"xmlUrl" => "http://www.wired.com/news_drop/netcenter/netcenter.rdf"
}
... ignore other lines
]
},
"head" => %{
"dateCreated" => "Sat, 18 Jun 2005 12:11:52 GMT",
"dateModified" => "Tue, 02 Aug 2005 21:42:48 GMT",
"expansionState" => "",
"ownerEmail" => "dave@scripting.com",
"ownerName" => "Dave Winer",
"title" => "mySubscriptions.opml",
"vertScrollState" => "1",
"windowBottom" => "562",
"windowLeft" => "304",
"windowRight" => "842",
"windowTop" => "61"
},
"version" => "2.0"
}
}
```
or return
```elixir
{:error, reason}
```
### Parsing with xml content
```elixir
> Opml.parse(~S{<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
<head>
<title>states.opml</title>
<dateCreated>Tue, 15 Mar 2005 16:35:45 GMT</dateCreated>
</head>
<body>
</body>
</opml>
})
```
### LICENSE
[MIT](LICENSE)