opml

package
v0.0.0-...-fd72eb8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2015 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package opml implements a parser for OPML files. See also: http://dev.opml.org/spec2.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OPML

type OPML struct {
	// XML name.
	XMLName xml.Name `xml:"opml"`

	// OPML standard version implemented by this file.
	Version string `xml:"version,attr"`

	// Title of the OPML document.
	Title string `xml:"head>title"`

	// Time the document was created.
	Created string `xml:"head>dateCreated"`

	// Array of outlines, each represents a subscription.
	Outlines []Outline `xml:"body>outline"`
}

OPML represent an OPML document.

func Create

func Create(title string) *OPML

Create returns a new OPML document with the given title. However, this is just syntax sugar. A file is only written after a call Save, it's the callers responsibility to do so if desired.

func Load

func Load(path string) (o *OPML, err error)

Load reads an existing OPML document located at the given path.

func (*OPML) Add

func (o *OPML) Add(text, ftype, url string)

Add appends a new outline to the OPML document, even if the outline is already a part of the document.

func (*OPML) Save

func (o *OPML) Save(path string) error

Save writes an indented version of the OPML document to the given file path.

type Outline

type Outline struct {
	// Text attribute, might contain HTML markup.
	Text string `xml:"text,attr"`

	// Type of file found at the outline URL.
	Type string `xml:"type,attr"`

	// Arbitrary outline URL.
	URL string `xml:"xmlUrl,attr"`
}

Outline represents an arbitrary OPML outline.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL