1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-07-01 11:48:38 -04:00

Trim spaces when unmarshalling UIDs

This ensures the correct value is parsed when SGML tags aren't closed.
Also add a test.
This commit is contained in:
2017-04-03 19:44:25 -04:00
parent 47f1b82c0b
commit 7834d53f9b
2 changed files with 17 additions and 0 deletions

View File

@ -237,6 +237,16 @@ func (ob Boolean) Equal(o Boolean) bool {
type UID string
func (ou *UID) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var value string
err := d.DecodeElement(&value, &start)
if err != nil {
return err
}
*ou = UID(strings.TrimSpace(value))
return nil
}
// The OFX specification recommends that UIDs follow the standard UUID
// 36-character format
func (ou UID) RecommendedFormat() (bool, error) {