[go-nuts] trying to learn xml unmarshaling

2017-06-07 Thread Tamás Gulácsi
Where is SEVERITY tag closed? The text you copied here is not an XML.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] trying to learn xml unmarshaling

2017-06-07 Thread rob
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



  

  0
  INFO

20170602063954
ENG

  Citibank
  2102

2102
  


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"`
DTENDstring `xml:"DTEND,OFX>BANKMSGSRSV1>STMTTRNRS>BANKTRANLIST"`
}

var citiheader citixmlheadertype
e = xml.Unmarshal(filebyteslice, ) // 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  closed by 

I guess I don't understand this yet.

Thanks,

Rob Solomon

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.