-
Notifications
You must be signed in to change notification settings - Fork 0
/
admi.004.001.02.xsd.go
79 lines (67 loc) · 2.26 KB
/
admi.004.001.02.xsd.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Code generated by download. DO NOT EDIT.
package iso20022_admi_004_001_02
import (
"bytes"
"encoding/xml"
"time"
)
type Document struct {
SysEvtNtfctn SystemEventNotificationV02 `xml:"urn:iso:std:iso:20022:tech:xsd:admi.004.001.02 SysEvtNtfctn"`
}
type Event2 struct {
EvtCd Max4AlphaNumericText `xml:"urn:iso:std:iso:20022:tech:xsd:admi.004.001.02 EvtCd"`
EvtParam []Max35Text `xml:"urn:iso:std:iso:20022:tech:xsd:admi.004.001.02 EvtParam,omitempty"`
EvtDesc Max1000Text `xml:"urn:iso:std:iso:20022:tech:xsd:admi.004.001.02 EvtDesc,omitempty"`
EvtTm ISODateTime `xml:"urn:iso:std:iso:20022:tech:xsd:admi.004.001.02 EvtTm,omitempty"`
}
type ISODateTime time.Time
func (t *ISODateTime) UnmarshalText(text []byte) error {
return (*xsdDateTime)(t).UnmarshalText(text)
}
func (t ISODateTime) MarshalText() ([]byte, error) {
return xsdDateTime(t).MarshalText()
}
// May be no more than 1000 items long
type Max1000Text string
// May be no more than 35 items long
type Max35Text string
// Must match the pattern [a-zA-Z0-9]{1,4}
type Max4AlphaNumericText string
type SystemEventNotificationV02 struct {
EvtInf Event2 `xml:"urn:iso:std:iso:20022:tech:xsd:admi.004.001.02 EvtInf"`
}
type xsdDateTime time.Time
func (t *xsdDateTime) UnmarshalText(text []byte) error {
return _unmarshalTime(text, (*time.Time)(t), "2006-01-02T15:04:05.999999999")
}
func (t xsdDateTime) MarshalText() ([]byte, error) {
return _marshalTime((time.Time)(t), "2006-01-02T15:04:05.999999999")
}
func (t xsdDateTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
if (time.Time)(t).IsZero() {
return nil
}
m, err := t.MarshalText()
if err != nil {
return err
}
return e.EncodeElement(m, start)
}
func (t xsdDateTime) MarshalXMLAttr(name xml.Name) (xml.Attr, error) {
if (time.Time)(t).IsZero() {
return xml.Attr{}, nil
}
m, err := t.MarshalText()
return xml.Attr{Name: name, Value: string(m)}, err
}
func _unmarshalTime(text []byte, t *time.Time, format string) (err error) {
s := string(bytes.TrimSpace(text))
*t, err = time.Parse(format, s)
if _, ok := err.(*time.ParseError); ok {
*t, err = time.Parse(format+"Z07:00", s)
}
return err
}
func _marshalTime(t time.Time, format string) ([]byte, error) {
return []byte(t.Format(format + "Z07:00")), nil
}