Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

xml - The 'minOccurs' attribute cannot be present

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...