'minOccurs' 属性不能存在 [英] The 'minOccurs' attribute cannot be present

查看:13
本文介绍了'minOccurs' 属性不能存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建我的 svcutil 命令行以从 .如果您想在此线程之外聊天,只需通过网站上发布的支持地址给我发送电子邮件.我保持 PDF 非常小,只专注于解释如何测试.zip 包含下载的 XSD 以及生成的 XSD.希望对你有帮助...

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.

解决方案

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.

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.

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

这篇关于'minOccurs' 属性不能存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆