1
I am trying to generate XSD.exe classes in C# from the Reinf XSD files:
EFD Reinf v1_04_00
http://sped.rfb.gov.br/arquivo/show/2802
As follows:
C:\Reinf\XSD>xsd evtInfoContribuinte-v1_04_00.xsd /classes
XSD.exe returns error:
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.6.1055.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#:Signature' el
ement is not declared. Line 754, position 10.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'evtInfoContribuinte-v1_04_00'.
- The element 'http://www.w3.org/2000/09/xmldsig#:Signature' is missing.
If you would like more help, please type "xsd /?".
C:\Reinf\XSD>xsd evtInfoContribuinte-v1_04_00.xsd /classes
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.6.1055.0]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.w3.org/2000/09/xmldsig#:Signature' el
ement is not declared. Line 754, position 10.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'evtInfoContribuinte-v1_04_00'.
- The element 'http://www.w3.org/2000/09/xmldsig#:Signature' is missing.
I understood that in XSD it is giving error here:
<xs:element ref="ds:Signature"/>
I removed this line and it worked.
My question: Would that be the correct procedure (remove)?
Since it is the XSD file provided by the IRS.
The generated classes would not be incomplete?
Generating the returnLoteEvents-v1_04_00.Cs from XSD, It generates in the generated class several duplicated references to these attributes: [System.CodeDom.Compiler.Generatedcodeattribute("xsd", "4.6.1055.0")] [System.Serializableattribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00")]
.... Which results in build errors Is it normal to ? Generate these duplicities?
– Vagner Costa
Another question: when generating the class by XSD.EXE are you setting a specific namespace for each XSD? I ask because some property names are already giving conflict of equal names.... Ex: The type "Tstatus" already contains a definition for "descRelature", where it has the same definition in returnsLoteEvents-v1_04_00.Cs and returnsTotalizerEvent-v1_04_00.Cs
– Vagner Costa
Yes, it is normal for the tool to create all these attributes, but probably this is not what is giving duplication error (and this will already answer your other comment), what is probably giving duplication error is that the root element of all schemas is the
Reinf
, then in the second scheme you convert will already duplicate, and, yes, we use different namespaces, see the tip I gave you in item 2 of that other answer: EFD Reinf v1_04_00 - How to instantiate and populate all Event properties?– Pedro Gaspar
I edited my answer here to include that information.
– Pedro Gaspar
Yes, it was very clear and the error corrected...
– Vagner Costa
Good, I hope one day that answer will be useful for someone! ;-)
– Pedro Gaspar