Closed syvanpera closed 3 years ago
Haven't really gone through all the possible places, but shouldn't this check in xmlElement.go
:
if attr.Name.Local == "maxOccurs" {
if attr.Value != "0" {
e.Plural = true
}
}
rather be:
if attr.Name.Local == "maxOccurs" {
if attr.Value > "1" {
e.Plural = true
}
}
Thanks for your issue, I have fixed it, please try to use the master branch code.
Description
When the xsd file has an element with
minOccurs="1"
andmaxOccurs="1"
, an array of elements if generated although in this case just a single element would be appropriate.Steps to reproduce the issue:
xgen -i test.xsd -o test -l Go
Describe the results you received: The generated Go file contains:
Describe the results you expected: