gilliek / go-opml

Go (golang) package for parsing OPML files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you use an outline?

jtagcat opened this issue · comments

Don't really understand go yet, how am I supposed to get multiple xmlURL-s (from a file)? All examples are // ....

Sorry for the late reply, I missed the notification.

After reading from a file with opml.NewOPMLFromFile you get an opml.OPML object. From there can get to the list of Outline that actually contains the XMLURL:

doc, err := opml.NewOPMLFromFile("path/to/file.xml")
if err != nil {
   log.Fatal(err)
}
for _, outline := range doc.Body.Outlines {
    fmt.Println("XMLURL:", outline.XMLURL)
}