使用 xsd.exe 生成 c# 文件,出现错误和警告

using xsd.exe to generate c# files, getting error and warnings(使用 xsd.exe 生成 c# 文件,出现错误和警告)
本文介绍了使用 xsd.exe 生成 c# 文件,出现错误和警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在运行的命令:

This is the command i'm running:

xsd.exe -c -l:c# D:DocumentsDEVSARPilotDocsschemas6-141r26-141r2.xsd

这些是我得到的错误:

Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: Undefined complexType 'http://www.opengis.net/sps/0:ParameterDescriptorType' is used as a base for comp
lex type extension. Line 617, position 2.
Schema validation warning: Undefined complexType 'http://www.opengis.net/ows:GetCapabilitiesType' is used as a base for complex ty
pe extension. Line 23, position 2.
Schema validation warning: Undefined complexType 'http://www.opengis.net/ows:CapabilitiesBaseType' is used as a base for complex t
ype extension. Line 35, position 2.
Schema validation warning: The 'http://www.opengis.net/gml:Point' element is not declared. Line 869, position 2.
Schema validation warning: The 'http://www.opengis.net/gml:Polygon' element is not declared. Line 870, position 2.
Schema validation warning: The 'http://www.opengis.net/gml:Rectangle' element is not declared. Line 871, position 2.
Schema validation warning: The 'http://www.opengis.net/sps/0:Parameter' element is not declared. Line 381, position 2.
Schema validation warning: The 'http://www.opengis.net/sps/0:ID' element is not declared. Line 451, position 2.

Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.

Error: Error generating classes for schema 'D:DocumentsDEVSARPilotDocsschemas6-141r26-141r2'.
  - The datatype 'http://www.opengis.net/ows:GetCapabilitiesType' is missing.

If you would like more help, please type "xsd /?".

C:Program Files (x86)Microsoft SDKsWindowsv7.0ABin>

XSD 文件是从以下文档的附录 A 中复制/粘贴的:http://services.eoportal.org/portal/documents/06-141r2_Ordering_Services_for_Earth_Observation_Products_0.9.2.pdf

The XSD file was copy/pasted from Appendix A in the following document: http://services.eoportal.org/portal/documents/06-141r2_Ordering_Services_for_Earth_Observation_Products_0.9.2.pdf

推荐答案

您链接的 PDF 文档中包含的 XML 架构使用 <import> 元素引用了其他几个 XSD 文件.您需要下载这些额外的架构文件,并确保 <import> 元素中的路径引用指向本地计算机上的正确位置.

The XML Schema included in the PDF document you linked has references to several other XSD files using the <import> element. You will need to download these additional schema files and make sure that the path references in the <import> elements are pointing to the correct locations on your local computer.

如果您仍然收到错误,那是因为 xsd.exe 无法跟进外部引用.要解决此问题,请直接在命令行中指定所有必需的 XSD 文件,如下所示:

If you are still getting errors, it is because xsd.exe could not follow up on external references. To solve this issue, specify all the required XSD files directly on the command line as follows:

xsd.exe/c MySchema.xsd Import01.xsd Import02.xsd Include01.xsd Include02.xsd

其中 Import01.xsd、Import02.xsd、Include01.xsd 和 Include02.xsd 是通过导入引用的 XSD 文件并包含 MySchema.xsd 中的元素.

where Import01.xsd, Import02.xsd, Include01.xsd and Include02.xsd are XSD files referenced via import and include elements in MySchema.xsd.

这篇关于使用 xsd.exe 生成 c# 文件,出现错误和警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)