Skip to content

Commit

Permalink
Implemented choices inside complex type extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jaytaph committed Feb 22, 2021
1 parent b77b4a4 commit cbc444a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions types_tmpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var typesTmpl = `
{{end}}
{{template "Elements" .Extension.Sequence}}
{{template "Elements" .Extension.Choice}}
{{template "Attributes" .Extension.Attributes}}
{{end}}
Expand Down Expand Up @@ -150,7 +151,7 @@ var typesTmpl = `
{{if ne $name $typ}}
XMLName xml.Name ` + "`xml:\"{{$targetNamespace}} {{$typ}}\"`" + `
{{end}}
{{if ne .ComplexContent.Extension.Base ""}}
{{template "ComplexContent" .ComplexContent}}
{{else if ne .SimpleContent.Extension.Base ""}}
Expand All @@ -164,7 +165,7 @@ var typesTmpl = `
{{template "Attributes" .Attributes}}
{{end}}
}
{{end}}
{{end}}
{{end}}
{{end}}
`
5 changes: 3 additions & 2 deletions xsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type XSDSchema struct {
Imports []*XSDImport `xml:"import"`
Elements []*XSDElement `xml:"element"`
Attributes []*XSDAttribute `xml:"attribute"`
ComplexTypes []*XSDComplexType `xml:"complexType"` //global
ComplexTypes []*XSDComplexType `xml:"complexType"` // global
SimpleType []*XSDSimpleType `xml:"simpleType"`
}

Expand Down Expand Up @@ -132,7 +132,7 @@ type XSDElement struct {
Ref string `xml:"ref,attr"`
MinOccurs string `xml:"minOccurs,attr"`
MaxOccurs string `xml:"maxOccurs,attr"`
ComplexType *XSDComplexType `xml:"complexType"` //local
ComplexType *XSDComplexType `xml:"complexType"` // local
SimpleType *XSDSimpleType `xml:"simpleType"`
Groups []*XSDGroup `xml:"group"`
}
Expand Down Expand Up @@ -192,6 +192,7 @@ type XSDExtension struct {
Base string `xml:"base,attr"`
Attributes []*XSDAttribute `xml:"attribute"`
Sequence []XSDElement `xml:"sequence>element"`
Choice []*XSDElement `xml:"choice>element"`
}

// XSDAttribute represent an element attribute. Simple elements cannot have
Expand Down

0 comments on commit cbc444a

Please sign in to comment.