rob
unread,Jun 7, 2017, 8:03:57 AM6/7/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golan...@googlegroups.com
Hi. I am trying to unmarshal the xml file I get from my bank. It seems
that the unmarshal routine cannot deal w/ the nested html fields.
sample.qfx
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
CHARSET:1252
COMPRESSION:NONE
OLDFILEUID:NONE
NEWFILEUID:NONE
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
</STATUS>
<DTSERVER>20170602063954
<LANGUAGE>ENG
<FI>
<ORG>Citibank
<FID>2102
</FI>
<INTU.BID>2102
</SONRS>
</SIGNONMSGSRSV1>
type citixmlheadertype struct {
DTSERVER string `xml:"DTSERVER,OFX>SIGNONMSGSRSV1>SONRS" `
LANGUAGE string `xml:"LANGUAGE,OFX>SIGNONMSGSRSV1>SONRS" `
ORG string `xml:"ORG,OFX>SIGNONMSGSRSVR1>SONRS>FI" `
FID int `xml:"FID,OFX>SIGNONMSGSRSVR1>SONRS>FI" `
CURDEF string `xml:"CURDEF,OFX>BANKMSGSRSV1>STMTTRNRS"`
BANKID string `xml:"BANKID,OFX>BANKMSGSRSV1>STMTTRNRS>BANKACCTFROM"`
ACCTID string `xml:"ACCTID,OFX>BANKMSGSRSV1>STMTTRNRS>BANKACCTFROM"`
ACCTTYPE string
`xml:"ACCTTYPE,OFX>BANKMSGSRSV1>STMTTRNRS>BANKACCTFROM"`
DTSTART string `xml:"DTSTART,OFX>BANKMSGSRSV1>STMTTRNRS>BANKTRANLIST"`
DTEND string `xml:"DTEND,OFX>BANKMSGSRSV1>STMTTRNRS>BANKTRANLIST"`
}
var citiheader citixmlheadertype
e = xml.Unmarshal(filebyteslice, &citiheader) // this requires a []byte
if e != nil {
fmt.Println(" Unmarshalling the header error", e)
os.Exit(1)
}
fmt.Printf(" header %#v \n", citiheader)
I'm getting an xml syntax error that "element <SEVERITY> closed by </STATUS>
I guess I don't understand this yet.
Thanks,
Rob Solomon