-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.go
53 lines (41 loc) · 1.68 KB
/
header.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
package bmecat
import "encoding/xml"
type Header struct {
XMLName xml.Name `xml:"HEADER"`
GeneratorInformation string `xml:"GENERATOR_INFO"`
CatalogInformation Catalog `xml:"CATALOG"`
BuyerInformation *Buyer `xml:"BUYER"`
SkeletonAgreements []Agreement `xml:"AGREEMENT"`
SupplierInformation Supplier `xml:"SUPPLIER"`
UserDefinedExtensions string `xml:"USER_DEFINED_EXTENSIONS"`
}
type Catalog struct {
XMLName xml.Name `xml:"CATALOG"`
Language string `xml:"LANGUAGE" validate:"omitempty,len=3"`
ID string `xml:"CATALOG_ID" validate:"max=20"`
Version string `xml:"CATALOG_VERSION" validate:"max=7"`
Name string `xml:"CATALOG_NAME,omitempty" validate:"max=100"`
Date *Datetime `xml:"DATETIME,omitempty"`
TerritorialAvailability []string `xml:"TERRITORY"`
StandardCurrency string `xml:"CURRENCY,omitempty" validate:"omitempty,len=3"`
MIMERoot string `xml:"MIME_ROOT,omitempty" validate:"max=100"`
}
type Buyer struct {
XMLName xml.Name `xml:"BUYER"`
ID *TypeID `xml:"BUYER_ID,omitempty"`
Name string `xml:"BUYER_NAME" validate:"required,max=50"`
}
type Supplier struct {
XMLName xml.Name `xml:"SUPPLIER"`
ID *TypeID `xml:"SUPPLIER_ID,omitempty"`
Name string `xml:"SUPPLIER_NAME" validate:"required,max=50"`
}
type TypeID struct {
Type string `xml:"type,attr" validate:"required"`
Value string `xml:",innerxml" validate:"required"`
}
type Agreement struct {
XMLName xml.Name `xml:"AGREEMENT"`
ID string `xml:"AGREEMENT_ID" validate:"required"`
Datetime []Datetime `xml:"DATETIME" validate:"min=1,max=2"`
}