forked from hooklift/gowsdl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xsd.go
114 lines (100 loc) · 4 KB
/
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package gowsdl
import (
"encoding/xml"
)
type XsdSchema struct {
XMLName xml.Name `xml:"schema"`
Tns string `xml:"xmlns tns,attr"`
Xs string `xml:"xmlns xs,attr"`
Version string `xml:"version,attr"`
TargetNamespace string `xml:"targetNamespace,attr"`
ElementFormDefault string `xml:"elementFormDefault,attr"`
Includes []*XsdInclude `xml:"include"`
Imports []*XsdImport `xml:"import"`
Elements []*XsdElement `xml:"element"`
ComplexTypes []*XsdComplexType `xml:"complexType"` //global
SimpleType []*XsdSimpleType `xml:"simpleType"`
}
type XsdInclude struct {
SchemaLocation string `xml:"schemaLocation,attr"`
}
type XsdImport struct {
XMLName xml.Name `xml:"import"`
SchemaLocation string `xml:"schemaLocation,attr"`
Namespace string `xml:"namespace,attr"`
}
type XsdElement struct {
XMLName xml.Name `xml:"element"`
Name string `xml:"name,attr"`
Doc string `xml:"annotation>documentation"`
Nillable bool `xml:"nillable,attr"`
Type string `xml:"type,attr"`
Ref string `xml:"ref,attr"`
MinOccurs string `xml:"minOccurs,attr"`
MaxOccurs string `xml:"maxOccurs,attr"`
ComplexType *XsdComplexType `xml:"complexType"` //local
SimpleType *XsdSimpleType `xml:"simpleType"`
Groups []*XsdGroup `xml:"group"`
}
type XsdComplexType struct {
XMLName xml.Name `xml:"complexType"`
Abstract bool `xml:"abstract,attr"`
Name string `xml:"name,attr"`
Mixed bool `xml:"mixed,attr"`
Sequence []XsdElement `xml:"sequence>element"`
Choice []XsdElement `xml:"choice>element"`
SequenceChoice []XsdElement `xml:"sequence>choice>element"`
All []XsdElement `xml:"all>element"`
ComplexContent XsdComplexContent `xml:"complexContent"`
SimpleContent XsdSimpleContent `xml:"simpleContent"`
Attributes []*XsdAttribute `xml:"attribute"`
}
type XsdGroup struct {
Name string `xml:"name,attr"`
Ref string `xml:"ref,attr"`
Sequence []XsdElement `xml:"sequence>element"`
Choice []XsdElement `xml:"choice>element"`
All []XsdElement `xml:"all>element"`
}
type XsdComplexContent struct {
XMLName xml.Name `xml:"complexContent"`
Extension XsdExtension `xml:"extension"`
}
type XsdSimpleContent struct {
XMLName xml.Name `xml:"simpleContent"`
Extension XsdExtension `xml:"extension"`
}
type XsdExtension struct {
XMLName xml.Name `xml:"extension"`
Base string `xml:"base,attr"`
Attributes []*XsdAttribute `xml:"attribute"`
Sequence []XsdElement `xml:"sequence>element"`
}
type XsdAttribute struct {
Name string `xml:"name,attr"`
Doc string `xml:"annotation>documentation"`
Type string `xml:"type,attr"`
SimpleType *XsdSimpleType `xml:"simpleType"`
}
type XsdSimpleType struct {
Name string `xml:"name,attr"`
Restriction XsdRestriction `xml:"restriction"`
}
type XsdRestriction struct {
Base string `xml:"base,attr"`
Enumeration []XsdRestrictionValue `xml:"enumeration"`
Pattern XsdRestrictionValue `xml:"pattern"`
MinInclusive XsdRestrictionValue `xml:"minInclusive"`
MaxInclusive XsdRestrictionValue `xml:"maxInclusive"`
WhiteSpace XsdRestrictionValue `xml:"whitespace"`
Length XsdRestrictionValue `xml:"length"`
MinLength XsdRestrictionValue `xml:"minLength"`
MaxLength XsdRestrictionValue `xml:"maxLength"`
}
type XsdRestrictionValue struct {
Doc string `xml:"annotation>documentation"`
Value string `xml:"value,attr"`
}