Switched from int to string for date epochs, thanks to Y! trailing spaces.
Change-Id: I81d6f5e42e63dafbbb7f3d64ced588dc32f4c381
This commit is contained in:
14
dmarc.go
14
dmarc.go
@@ -9,8 +9,9 @@ import (
|
|||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
type DateRange struct {
|
type DateRange struct {
|
||||||
Begin int `xml:"begin"`
|
// TODO: should be int but Y! trailing spaces
|
||||||
End int `xml:"end"`
|
Begin string `xml:"begin"`
|
||||||
|
End string `xml:"end"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReportMetadata struct {
|
type ReportMetadata struct {
|
||||||
@@ -71,7 +72,7 @@ func main() {
|
|||||||
Record []Record `xml:"record"`
|
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 {
|
if err != nil {
|
||||||
fmt.Printf("os error: %v", err)
|
fmt.Printf("os error: %v", err)
|
||||||
return
|
return
|
||||||
@@ -90,9 +91,12 @@ func main() {
|
|||||||
case xml.StartElement:
|
case xml.StartElement:
|
||||||
inElement = se.Name.Local
|
inElement = se.Name.Local
|
||||||
if inElement == "feedback" {
|
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)
|
fmt.Printf("XMLName: %#v\n", f)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user