2

I'm in the process of building my svcutil command line to generate business objects from the OSEO schema.

Whenever it tells me "xxx" type is missing, i determine what xsd i need to include to the command line and add it. So far my command line looks like this:

svcutil /language:C# /namespace:*,OGC.OSEO.DataContract /out:IOSEO.cs oseo/1.0/oseo.wsdl oseo/1.0/oseo.xsd ows/2.0/owsAll.xsd ows/2.0/ows19115subset.xsd ows/2.0/owsAdditionalParameters.xsd ows/2.0/owsCommon.xsd ows/2.0/owsContents.xsd ows/2.0/owsDataIdentification.xsd ows/2.0/owsExceptionReport.xsd ows/2.0/owsGetCapabilities.xsd ows/2.0/owsGetResourceByID.xsd ows/2.0/owsInputOutputData.xsd ows/2.0/owsManifest.xsd ows/2.0/owsOperationsMetadata.xsd ows/2.0/owsServiceIdentification.xsd ows/2.0/owsServiceProvider.xsd ows/2.0/owsDomainType.xsd http://www.w3.org/2006/03/addressing/ws-addr.xsd sweCommon/2.0/block_components.xsd sweCommon/2.0/advanced_encodings.xsd sweCommon/2.0/basic_types.xsd sweCommon/2.0/choice_components.xsd sweCommon/2.0/record_components.xsd sweCommon/2.0/simple_components.xsd sweCommon/2.0/simple_encodings.xsd sweCommon/2.0/swe.xsd xlink/1.0.0/xlinks.xsd swes/2.0/swes.xsd swes/2.0/swesCommon.xsd swes/2.0/swesContents.xsd swes/2.0/swesDeleteSensor.xsd swes/2.0/swesDescribeSensor.xsd swes/2.0/swesInsertSensor.xsd swes/2.0/swesNotification.xsd swes/2.0/swesUpdateSensorDescription.xsd gml/3.2.1/basicTypes.xsd gml/3.2.1/coordinateOperations.xsd gml/3.2.1/coordinateReferenceSystems.xsd gml/3.2.1/coordinateSystems.xsd gml/3.2.1/coverage.xsd gml/3.2.1/datums.xsd gml/3.2.1/defaultStyle.xsd gml/3.2.1/deprecatedTypes.xsd gml/3.2.1/dictionary.xsd gml/3.2.1/direction.xsd gml/3.2.1/dynamicFeature.xsd gml/3.2.1/feature.xsd gml/3.2.1/geometryAggregates.xsd gml/3.2.1/geometryBasic0d1d.xsd gml/3.2.1/geometryBasic2d.xsd gml/3.2.1/geometryComplexes.xsd gml/3.2.1/geometryPrimitives.xsd gml/3.2.1/gml.xsd gml/3.2.1/gmlBase.xsd gml/3.2.1/grids.xsd gml/3.2.1/measures.xsd gml/3.2.1/observation.xsd gml/3.2.1/referenceSystems.xsd gml/3.2.1/temporal.xsd gml/3.2.1/temporalReferenceSystems.xsd gml/3.2.1/temporalTopology.xsd gml/3.2.1/topology.xsd gml/3.2.1/units.xsd gml/3.2.1/valueObjects.xsd gmd/applicationSchema.xsd gmd/citation.xsd gmd/constraints.xsd gmd/content.xsd gmd/dataQuality.xsd gmd/distribution.xsd gmd/extent.xsd gmd/freeText.xsd gmd/gmd.xsd gmd/identification.xsd gmd/maintenance.xsd gmd/metadataApplication.xsd gmd/metadataEntity.xsd gmd/metadataExtension.xsd gmd/portrayalCatalogue.xsd gmd/referenceSystem.xsd gmd/spatialRepresentation.xsd gco/basicTypes.xsd gco/gcoBase.xsd gts/temporalObjects.xsd gss/geometry.xsd gsr/spatialReferencing.xsd smil20/smil20-animate.xsd smil20/smil20-animate.xsd smil20/smil20-language.xsd

So i've hit a stump on the lastest xsd to add to the command line which is the smil20-language.xsd

I'm getting the following error:

The 'minOccurs' attribute cannot be present

As you can see from the xsd there are many 'minOccurs'.

So my question is: Which ones are causing these errors? How do i find out?

The error in it's entirety does not give a line number, code or any hints whatsoever.

enter image description here

capdragon
  • 14,565
  • 24
  • 107
  • 153
  • Try putting the same schema through a more user-friendly XSD processor. – Michael Kay Jan 17 '12 at 16:37
  • @Michael Kay: Any XSD processor suggestions? (freeware) – capdragon Jan 17 '12 at 16:42
  • The set of XSD files referenced from the provided URL is valid. However, individual files within the set seem to have issues, by not directly referencing content where is needed. E.g. gmlBase.xsd (http://schemas.opengis.net/gml/3.2.1/gmlBase.xsd) references gml:remoteSchema, a global attribute that is defined in deprecatedTypes.xsd. svcutil would have a hard time figuring that out. The best way for you would be to refactor the entire set (all you need is actually 15 XSD files, as opposed to 100+) and take it from there with svcutil. Let me know if interested, and I'll post a detailed answer. – Petru Gardea Jan 17 '12 at 16:53
  • I am interested...not sure what you mean by `refactor` but i'm willing to give it a shot. – capdragon Jan 17 '12 at 17:07
  • @Petru: I appreciate your comments. Do you recommend Oxygen XML Editor to do this? – capdragon Jan 17 '12 at 17:25
  • Sorry, I am not familiar with Oxygen. I am using (and I am associated with) QTAssistant, particularly the XSR module. My intent was to prepare for you a doc that would show you how to save all the XSDs locally, how to refactor them into minimal set of files, and do a test with svcutil.exe. Additionally, I would've added a diff to show how filtering of XSD content impacts generated classes, without affecting the functionality (removing unreferenced XSD). If you have to rely on Oxygen, unfortunately, I cannot speak to that. – Petru Gardea Jan 17 '12 at 17:59
  • Go ahead with the doc preparation. I don't even own Oxygen, i was just doing research on the schema refactoring and google pointed me to oxygen. Unfortunately, i cannot find this QTAssistant you mention but i'm sure you'll probably mention where i can find it in the doc. – capdragon Jan 17 '12 at 18:38
  • By bringing down the number of XSD files to 15 through the refactoring I was referring to, and using xsd.exe instead, I was able to successfully generate and compile the schema set you refer to. I'll post an answer later on. – Petru Gardea Jan 19 '12 at 17:38
  • sounds promising... anxiously awaiting your answer. – capdragon Jan 19 '12 at 17:40

1 Answers1

7

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...

Petru Gardea
  • 21,373
  • 2
  • 50
  • 62
  • That tool is absolutely amazing! – capdragon Jan 20 '12 at 20:39
  • I know this is an old post.. Petru - do you have a link to your tool? I am facing a similar problem with a different collection of XSDs – baradhili Nov 29 '21 at 04:23
  • @baradhili, yes, the tool is still maintained and available. We've been having issues with our hosting provider and we're in the process of transitioning to a new platform. If you need this sooner, send an email directly to our support team csupport (at) paschidev (dot) com and they'll provide you with the download link. – Petru Gardea Nov 29 '21 at 18:30