Error creating class .CS with xsd.exe in VisualStudio 2015

1

I am creating a class with the xsd.exe tool and when executing the command I get the following error: Schema validation warning The element ' link '. Line 667, position 6.

This is line 667 of the file

<xs:element ref="ds:Signature" minOccurs="1" maxOccurs="1"/>

This is the header of the xsd file

<xs:schema xmlns="https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/facturaElectronica" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" targetNamespace="https://tribunet.hacienda.go.cr/docs/esquemas/2017/v4.2/facturaElectronica" elementFormDefault="qualified" attributeFormDefault="unqualified" version="4.2" vc:minVersion="1.1">
<xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2008/REC-xmldsig-core-20080610/xmldsig-core-schema.xsd"/>

Apartir of this line is the error

<xs:element ref="ds:Signature" minOccurs="1" maxOccurs="1"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="EmisorType">
    
asked by Efrain Mejias C 30.08.2017 в 21:33
source

2 answers

1

In the file header the xmlns:ds="http://www.w3.org/2000/09/xmldsig#" definition must resolve to a path where the XSD file is located. That is to say, your route must end with .xsd and there in that route should be the xsd file that defines the namespace ds. That is why it marks an error because the XSD file does not exist in the current route.

    
answered by 04.09.2017 / 18:44
source
3

if you have the file xmldsig-core-schema.xsd add it when creating the classes with the xsd.

Something like this:

CMD-->  xsd TuDocumento.xsd xmldsig-core-schema.xsd /Classes
    
answered by 04.09.2017 в 15:27