Created
September 4, 2014 04:04
-
-
Save CarlosEspejo/36b8854be1466ed83826 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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