xmlxsddtdxsd.execxml

Generating cXML classes from xsd throws error "The element 'uri:ds:Signature' is missing."


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

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.

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

Then I ran

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

But that threw

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

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

I can see that

<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">

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

I also tried adding reference to local signature xsd by adding

<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.


Solution

  • 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" /> -->
    

    and it then work perfectly.