The ‘minOccurs’ attribute cannot be present

The XML Schema set that’s made up of all files that can be traced from the OSEO schema link you have provided, is valid. The tools, unfortunately, don’t seem able to just deal with that one file; which makes the whole process cumbersome, since there are 104 files in total… with very complex include/imports.

Out of the box OSEO

I’ll describe what I was able to do to make it work, using the tool available to me (and with which I am associated). I won’t be able to provide explanations as to why xsd.exe or svcutil.exe behave the way they do; for sure, most interesting might be to reverse engineer them…

I’ve imported all the XSD files on my local machine. I used the tool; it preserves the layout and it automatically rewrites <xsd:include/>s/<xsd:import/>s schemaLocation attribute to maintain the integrity of the download.

I’ve refactored the entire set so that I get the equivalent, but using the minimum possible number of XSD files.

OSOE refactored minimum set

Using the generated files, I’ve ran the following xsd.exe command line; the C# class came out clean, with no errors or warnings in the output.

xsd oseo.xsd gco.xsd gmd.xsd gml.xsd  gsr.xsd  gss.xsd gts.xsd ows-1-1.xsd ows-2-0.xsd swe.xsd swes.xsd ws-addr.xsd wsn.xsd xlinks.xsd xml.xsd /c

Trying the same set with svcutil won’t work; it complains about the schema as being invalid… Unfortunately, I didn’t have time to look into.

The entire solution and tool specific instructions are in the zip available at this link. if you want to chat outside this thread, just send me an email via the support address posted on the website. I kept the PDF really small, focused on explaining how to test only. The zip contains the XSDs downloaded, as well as the generated XSDs. Hope it helps…

Leave a Comment