c# - 使用 xsd.exe 从 ereg 关联生成 c# 文件

标签 c# xsd

我正在尝试转换 XSD一些 C# 类。我已经用很多其他文件完成了此操作,但我想知道为什么这个文件不起作用。

schema information在下载部分包含指向 the XSD file 的链接我已经下载到我的本地磁盘。然后从 ms 开发工具运行 XSD 命令。

这是来自命令提示符的转储:

C:\temp\XSD>xsd version-13-draft-ivi-xsd-scheme.xsd /classes  /namespace:MyNamespace
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.6.1055.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig:Signature' element is not declared. Line 17, position 5.

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

Error: Error generating classes for schema 'version-13-draft-ivi-xsd-scheme'.
- The element 'http://www.w3.org/2000/09/xmldsig#:Signature' is missing.

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

XSD 验证器似乎无法下载签名命名空间。但我不确定到底发生了什么。谁能解释一下出了什么问题?

最佳答案

下载http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd到您的本地目录,并将其作为另一个参数添加到您的命令中:

xsd version-13-draft-ivi-xsd-scheme.xsd xmldsig-core-schema.xsd /Classes

您要导入的 xsd 在第 7 行包含对该文件的引用:

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>

关于c# - 使用 xsd.exe 从 ereg 关联生成 c# 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45921523/

相关文章:

c# - 选择数组 C# 的替代项

java - 找不到元素 'beans' 的声明。

c# - 通过 MVC 集成将上下文传递给 FluentValidation 中的集合验证器

c# - 返回字节数组作为具有 Image/png 内容类型的 Http 响应

xml - Maven 构建失败,Liquibase : cvc-elt. 1 找不到元素声明

c++ - 在 C++ 中从 XML 模式生成 XML 文档

xml - 我在我的 XSD 中指定什么来跳过 xml 标记的属性验证

c# - 如何将模式包含在 xml 中

c# - Entity Framework 、dll、excel

c# - Java 和 C# 之间的不同 SHA1 哈希结果