go-opml aims to be a Go package for parsing OPML files.
go get github.com/gilliek/go-opml/opml
Parse OPML from file:
package main
import (
"fmt"
"log"
"github.com/gilliek/go-opml/opml"
)
func main() {
doc, err := opml.NewOPMLFromFile("path/to/file.xml")
if err != nil {
log.Fatal(err)
}
xml, _ := doc.XML()
fmt.Println(xml)
//...
}
Parse OPML from URL:
package main
import (
"fmt"
"log"
"github.com/gilliek/go-opml/opml"
)
func main() {
doc, err := opml.NewOPMLFromURL("http://www.example.com/file.xml")
if err != nil {
log.Fatal(err)
}
xml, _ := doc.XML()
fmt.Println(xml)
//...
}
Document can be found on GoWalker or GoDoc
BSD 3-clauses