Skip to content

Instantly share code, notes, and snippets.

@CarlosEspejo
Created September 4, 2014 04:04
Show Gist options
  • Save CarlosEspejo/36b8854be1466ed83826 to your computer and use it in GitHub Desktop.
Save CarlosEspejo/36b8854be1466ed83826 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"os"
"compress/gzip"
"encoding/xml"
)
func main() {
files := []string{"/Users/carlos/projects/prototype/data.gz"}
for _, file := range files {
f, _ := os.Open(file)
reader, err := gzip.NewReader(f)
if err != nil {
fmt.Println(err)
continue
}
var b Feed
xml.NewDecoder(reader).Decode(&b)
fmt.Println(b)
reader.Close()
f.Close()
}
}
type Source struct {
Crawled_at string `xml:"crawled,attr"`
}
type Feed struct {
XMLName xml.Name `xml:"Feed"`
Source []Source
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment