XSD签名问题

Dev*_*per 4 xml xsd digital-signature visual-studio xml-signature

我无法解决这个错误<xs:element ref="ds:Signature"/>.我需要一些帮助.

版权所有(C)Microsoft Corporation.版权所有.架构验证警告:未声明' http://www.w3.org/2000/09/xmldsig#:Signature '元素.第162行,第8位.

警告:无法验证架构.类生成可能会失败或可能产生不正确的结果.

警告:无法生成类,因为找不到具有复杂类型的顶级元素.

XSD

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"  
            xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
  attributeFormDefault="unqualified" elementFormDefault="qualified">

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

             <xs:complexType name="SobreCheques">
        <xs:annotation>
            <xs:documentation>Definition of the ...</xs:documentation>
        </xs:annotation>
        <xs:sequence>
             ...
      <xs:element ref="ds:Signature"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
Run Code Online (Sandbox Code Playgroud)

kjh*_*hes 9

xmldsig-core-schema.xsd从W3C站点检索可能需要很长时间,导致超时.

而是在与XSD相同的目录中使用缓存的本地副本,

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"
           schemaLocation="xmldsig-core-schema.xsd"/>
Run Code Online (Sandbox Code Playgroud)

或者在评论中使用@ulab所示的绝对路径:

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#"   
           schemaLocation="file:///D:/xmldsig-core-schema.xsd" />
Run Code Online (Sandbox Code Playgroud)

另请参见如何正确引用本地XML架构文件?