从xsd生成cXML类会引发错误“缺少元素'uri:ds:Signature'." [英] Generating cXML classes from xsd throws error "The element 'uri:ds:Signature' is missing."

查看:175
本文介绍了从xsd生成cXML类会引发错误“缺少元素'uri:ds:Signature'."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据 http://cxml.org/ XSD(由Visual Studio转换).

I'm trying to generate cXML classes for version cXML 1.2.034 as per http://cxml.org/ XSD (converted by visual studio).

我将cXML.dtd转换为xsd.然后尝试运行:

I converted the cXML.dtd to xsd. Then Tried running:

xsd.exe cXML.xsd /c /language:CS /n:MyNamespace

但是它引发了一个错误:

But it threw an error:

Error: Error generating classes for schema 'cXML'. - The element 'uri:ds:Signature' is missing.

Error: Error generating classes for schema 'cXML'. - The element 'uri:ds:Signature' is missing.

然后我在这里发现了这个问题:从XSD生成C#类似乎相关.因此,我从

Then I found this issue here: Generating C# classes from XSD which seems relevant. So I downloaded xmldsig-core-schema.xsd from http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd

然后我跑了

xsd.exe cXML.xsd xmldsig-core-schema.xsd /c /language:CS /n:MyNamespace

但是扔了

Error: Error generating classes for schema 'cXML_xmldsig-core-schema'. - The element 'uri:ds:Signature' is missing.

Error: Error generating classes for schema 'cXML_xmldsig-core-schema'. - The element 'uri:ds:Signature' is missing.

我对'uri:ds:Signature'"应该是什么感到迷惑?

I'm lost as to what "'uri:ds:Signature'" is supposed to be?

我可以看到

<xs:schema xmlns="http://tempuri.org/cXML" xmlns:ds="uri:ds" elementFormDefault="qualified" targetNamespace="http://tempuri.org/cXML" xmlns:xs="http://www.w3.org/2001/XMLSchema">

似乎错误.我将其更改为xmlns:ds="http://www.w3.org/2000/09/xmldsig#",但仍然存在相同的问题.

seems wrong. I changed it to xmlns:ds="http://www.w3.org/2000/09/xmldsig#" but same issue persists.

我还尝试通过添加

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/>,是的,该文件与我自己的xsd文件位于同一目录中.

<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd"/> and yes I have the file in the same directory as my own xsd file.

推荐答案

我遇到了同样的问题.我像您一样尝试了几次尝试(导入 https://www .w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd 模式,但确实找到了方法.)

I had the same problem. I tried several attemps like you (import the https://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd schema, but did find how).

就我而言,我只删除有问题的整行:

In my case, I just remove the whole line that was problematic :

<!-- COMMENTED <xs:element minOccurs="0" maxOccurs="unbounded" ref="ds:Signature" /> -->

然后完美运行.

这篇关于从xsd生成cXML类会引发错误“缺少元素'uri:ds:Signature'."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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