As an Xml / infer schema tool in visual studio, whenever I used XSD.exe, I decided to fix some of the generated code. XSD.exe does a good approximation, but it does not work fully.
The error minOccurs / maxOccurs' is documented in MSDN.
When generating source code from an XML Schema Document, Xsd.exe ignores the minOccurs attribute that applies to <select> <sequence>, <group>, <all>, and <any> elements.
For an Xsd.exe element, it ignores the minOccurs attribute if the maxOccurs attribute value is greater than 1 or unlimited. In this case, the tool creates an array type corresponding to the given XSD type. Xsd.exe uses the value of the maxOccurs attribute to determine whether to create a single instance or array.
For the Xsd.exe element, it also ignores the minOccurs attribute if it is applied to the schema data type that is converted to a reference type in the .NET Framework.
Only under the following conditions are true. Xsd.exe uses the value of the minOccurs attribute:
Element is involved.
The maxOccurs attribute defines a single instance.
The data type is converted to a value of type.
amelvin
source share