使用 VS 2013 附带的 XSD 工具,我收到以下消息,尝试从包含以下内容的 xsd 生成类:<xsd:element ref=.../>
-
架构验证警告: 'http://www.w3.org/2000/09/xmldsig#:密钥名称 http://www.w3.org/2000/09/xmldsig#:KeyName' 元素未声明。 14 号线,位置 8。
警告:无法验证架构。类生成可能会失败或可能产生不正确的结果。
错误:为架构“测试”生成类时出错。
- 元素 'http://www.w3.org/2000/09/xmldsig#:签名 http://www.w3.org/2000/09/xmldsig#:Signature' 不见了。
这是一个简化的 xsd,演示了该问题:
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema id="test"
targetNamespace="http://tempuri.org/test.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/test.xsd"
xmlns:mstns="http://tempuri.org/test.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sig="http://www.w3.org/2000/09/xmldsig#"
>
<xsd:import schemaLocation="xmldsig-core-schema.xsd" namespace="http://www.w3.org/2000/09/xmldsig#" />
<xsd:complexType name="test" >
<xsd:sequence >
<xsd:element ref="sig:Signature" minOccurs="0" maxOccurs="unbounded"></xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element type="test" name="top"/>
</xsd:schema>
我很确定导入和命名空间都没有问题。 Resharper 和 VS 架构设计器不会抱怨。我怀疑这是该工具无法做到的事情。
我有什么想法可以继续吗?
原来这个问题在这里已经有了答案。
https://stackoverflow.com/a/17278163/2516770 https://stackoverflow.com/a/17278163/2516770
我需要将导入的文件添加到xsd命令行参数的文件列表中:
xsd test.xsd xmldsig-core-schema.xsd /c
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)