Switched from int to string for date epochs, thanks to Y! trailing spaces.

Change-Id: I81d6f5e42e63dafbbb7f3d64ced588dc32f4c381
This commit is contained in:
Greg Colburn
2015-11-27 07:46:01 -07:00
parent c5c597ff92
commit 69558c196d

View File

@@ -9,8 +9,9 @@ import (
func main() {
type DateRange struct {
Begin int `xml:"begin"`
End int `xml:"end"`
// TODO: should be int but Y! trailing spaces
Begin string `xml:"begin"`
End string `xml:"end"`
}
type ReportMetadata struct {
@@ -71,7 +72,7 @@ func main() {
Record []Record `xml:"record"`
}
xmlFile, err := os.Open("/Users/gcolburn/go/src/github.com/gc1code/dmarcparser/samples/google.xml") // For read access.
xmlFile, err := os.Open("/Users/gcolburn/go/src/github.com/gc1code/dmarcparser/samples/yahoo.xml") // For read access.
if err != nil {
fmt.Printf("os error: %v", err)
return
@@ -90,9 +91,12 @@ func main() {
case xml.StartElement:
inElement = se.Name.Local
if inElement == "feedback" {
var f FeedbackReport
f := FeedbackReport{}
decoder.DecodeElement(&f, &se)
xmlerr := decoder.DecodeElement(&f, &se)
if xmlerr != nil {
fmt.Printf("decode error: %v", xmlerr)
}
fmt.Printf("XMLName: %#v\n", f)
}
default: